parent
f6330aabf3
commit
5b49b1dd33
@ -285,6 +285,7 @@ class WebApi(BaseApi):
|
||||
return json_res['data']['timestamp']
|
||||
|
||||
async def get_user_info(self, uid: int) -> ResponseData:
|
||||
# FIXME: "code": -352, "message": "风控校验失败",
|
||||
path = '/x/space/wbi/acc/info'
|
||||
params = {'mid': uid}
|
||||
json_res = await self._get_json(self.base_api_urls, path, params=params)
|
||||
|
@ -231,11 +231,9 @@ class Live:
|
||||
)
|
||||
async def get_user_info(self, uid: int) -> UserInfo:
|
||||
try:
|
||||
user_info_data = await self._webapi.get_user_info(uid)
|
||||
return UserInfo.from_web_api_data(user_info_data)
|
||||
return await self._get_user_info_via_api(uid)
|
||||
except Exception:
|
||||
user_info_data = await self._appapi.get_user_info(uid)
|
||||
return UserInfo.from_app_api_data(user_info_data)
|
||||
return await self._get_user_info_via_html_page()
|
||||
|
||||
async def get_timestamp(self) -> int:
|
||||
try:
|
||||
@ -343,6 +341,18 @@ class Live:
|
||||
room_info_data = await self._get_room_info_via_api()
|
||||
return int(room_info_data['live_status'])
|
||||
|
||||
async def _get_user_info_via_api(self, uid: int) -> UserInfo:
|
||||
try:
|
||||
data = await self._webapi.get_info_by_room(self._room_id)
|
||||
return UserInfo.from_info_by_room(data)
|
||||
except Exception:
|
||||
try:
|
||||
data = await self._appapi.get_info_by_room(self._room_id)
|
||||
return UserInfo.from_info_by_room(data)
|
||||
except Exception:
|
||||
data = await self._appapi.get_user_info(uid)
|
||||
return UserInfo.from_app_api_data(data)
|
||||
|
||||
async def _get_room_info_via_api(self) -> ResponseData:
|
||||
try:
|
||||
info_data = await self._webapi.get_info_by_room(self._room_id)
|
||||
@ -365,6 +375,10 @@ class Live:
|
||||
|
||||
return int(m.group(1))
|
||||
|
||||
async def _get_user_info_via_html_page(self) -> UserInfo:
|
||||
info_res = await self._get_room_info_res_via_html_page()
|
||||
return UserInfo.from_info_by_room(info_res)
|
||||
|
||||
async def _get_room_info_via_html_page(self) -> ResponseData:
|
||||
info_res = await self._get_room_info_res_via_html_page()
|
||||
return info_res['room_info']
|
||||
|
@ -50,10 +50,10 @@ class RoomInfo:
|
||||
else:
|
||||
raise ValueError(f'Failed to init live_start_time: {data}')
|
||||
|
||||
if (cover := data.get('cover') or data.get('user_cover', '')):
|
||||
if cover := data.get('cover') or data.get('user_cover', ''):
|
||||
cover = ensure_scheme(cover, 'https')
|
||||
|
||||
if (description := data['description']):
|
||||
if description := data['description']:
|
||||
description = re.sub(r'<br\s*/?>', '\n', description)
|
||||
tree = html.fromstring(description)
|
||||
description = clean_html(tree).text_content().strip()
|
||||
@ -82,8 +82,6 @@ class UserInfo:
|
||||
gender: str
|
||||
face: str
|
||||
uid: int
|
||||
level: int
|
||||
sign: str
|
||||
|
||||
@staticmethod
|
||||
def from_web_api_data(data: ResponseData) -> 'UserInfo':
|
||||
@ -92,8 +90,6 @@ class UserInfo:
|
||||
gender=data['sex'],
|
||||
face=ensure_scheme(data['face'], 'https'),
|
||||
uid=data['mid'],
|
||||
level=data['level'],
|
||||
sign=data['sign'],
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
@ -101,9 +97,18 @@ class UserInfo:
|
||||
card = data['card']
|
||||
return UserInfo(
|
||||
name=card['name'],
|
||||
gender=card['sex'],
|
||||
gender=card.get('sex', ''),
|
||||
face=ensure_scheme(card['face'], 'https'),
|
||||
uid=card['mid'],
|
||||
level=card['level_info']['current_level'],
|
||||
sign=card['sign'],
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def from_info_by_room(data: ResponseData) -> 'UserInfo':
|
||||
room_info = data['room_info']
|
||||
base_info = data['anchor_info']['base_info']
|
||||
return UserInfo(
|
||||
name=base_info['uname'],
|
||||
gender=base_info['gender'],
|
||||
face=ensure_scheme(base_info['face'], 'https'),
|
||||
uid=room_info['uid'],
|
||||
)
|
||||
|
@ -514,11 +514,9 @@ class Recorder(
|
||||
|
||||
msg = f"""
|
||||
================================== User Info ==================================
|
||||
user id : {user_info.uid}
|
||||
user name : {user_info.name}
|
||||
gender : {user_info.gender}
|
||||
sign : {user_info.sign}
|
||||
uid : {user_info.uid}
|
||||
level : {user_info.level}
|
||||
---------------------------------- Room Info ----------------------------------
|
||||
title : {room_info.title}
|
||||
cover : {room_info.cover}
|
||||
|
File diff suppressed because one or more lines are too long
1
src/blrec/data/webapp/287.d162f6c8e5d14fac.js
Normal file
1
src/blrec/data/webapp/287.d162f6c8e5d14fac.js
Normal file
File diff suppressed because one or more lines are too long
@ -10,6 +10,6 @@
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
<noscript>Please enable JavaScript to continue using this application.</noscript>
|
||||
<script src="runtime.4d25db3be3119aaf.js" type="module"></script><script src="polyfills.4e5433063877ea34.js" type="module"></script><script src="main.f21b7d831ad9cafb.js" type="module"></script>
|
||||
<script src="runtime.187894a5650ad4b5.js" type="module"></script><script src="polyfills.4e5433063877ea34.js" type="module"></script><script src="main.f21b7d831ad9cafb.js" type="module"></script>
|
||||
|
||||
</body></html>
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"configVersion": 1,
|
||||
"timestamp": 1699163406878,
|
||||
"timestamp": 1703317848279,
|
||||
"index": "/index.html",
|
||||
"assetGroups": [
|
||||
{
|
||||
@ -12,7 +12,7 @@
|
||||
},
|
||||
"urls": [
|
||||
"/103.4a2aea63cc3bf42b.js",
|
||||
"/287.63ace7ac80c3d9f2.js",
|
||||
"/287.d162f6c8e5d14fac.js",
|
||||
"/386.2404f3bc252e1df3.js",
|
||||
"/503.6553f508f4a9247d.js",
|
||||
"/548.e2df47ddad764d0b.js",
|
||||
@ -22,7 +22,7 @@
|
||||
"/main.f21b7d831ad9cafb.js",
|
||||
"/manifest.webmanifest",
|
||||
"/polyfills.4e5433063877ea34.js",
|
||||
"/runtime.4d25db3be3119aaf.js",
|
||||
"/runtime.187894a5650ad4b5.js",
|
||||
"/styles.ae81e04dfa5b2860.css"
|
||||
],
|
||||
"patterns": []
|
||||
@ -1635,7 +1635,7 @@
|
||||
"dataGroups": [],
|
||||
"hashTable": {
|
||||
"/103.4a2aea63cc3bf42b.js": "2711817f2977bfdc18c34fee4fe9385fe012bb22",
|
||||
"/287.63ace7ac80c3d9f2.js": "7a52c7715de66142dae39668a3a0fb0f9ee4bb50",
|
||||
"/287.d162f6c8e5d14fac.js": "87700d76c3cb0fe9890bbe63ad3d388619f95874",
|
||||
"/386.2404f3bc252e1df3.js": "f937945645579b9651be2666f70cec2c5de4e367",
|
||||
"/503.6553f508f4a9247d.js": "0878ea0e91bfd5458dd55875561e91060ecb0837",
|
||||
"/548.e2df47ddad764d0b.js": "0b60f5f001bd127b90d490617bba2091c4c39de3",
|
||||
@ -3234,11 +3234,11 @@
|
||||
"/assets/twotone/warning.js": "fb2d7ea232f3a99bf8f080dbc94c65699232ac01",
|
||||
"/assets/twotone/warning.svg": "8c7a2d3e765a2e7dd58ac674870c6655cecb0068",
|
||||
"/common.1fc175bce139f4df.js": "af1775164711ec49e5c3a91ee45bd77509c17c54",
|
||||
"/index.html": "2a844a95b7b6367d4be88cef11f92da722cdfb0b",
|
||||
"/index.html": "45319421e7503c2b6728d1d3a0566803571e4d4e",
|
||||
"/main.f21b7d831ad9cafb.js": "fc51efa446c2ac21ee17e165217dd3faeacc5290",
|
||||
"/manifest.webmanifest": "62c1cb8c5ad2af551a956b97013ab55ce77dd586",
|
||||
"/polyfills.4e5433063877ea34.js": "68159ab99e0608976404a17132f60b5ceb6f12d2",
|
||||
"/runtime.4d25db3be3119aaf.js": "a384a1a5336bd3394ebe6d0560ed6c28b7020af9",
|
||||
"/runtime.187894a5650ad4b5.js": "a8a395434979ff91b295fe1ce37b258aa55e0121",
|
||||
"/styles.ae81e04dfa5b2860.css": "5933b4f1c4d8fcc1891b68940ee78af4091472b7"
|
||||
},
|
||||
"navigationUrls": [
|
||||
|
@ -1 +1 @@
|
||||
(()=>{"use strict";var e,v={},m={};function r(e){var n=m[e];if(void 0!==n)return n.exports;var t=m[e]={exports:{}};return v[e](t,t.exports,r),t.exports}r.m=v,e=[],r.O=(n,t,f,o)=>{if(!t){var a=1/0;for(i=0;i<e.length;i++){for(var[t,f,o]=e[i],c=!0,u=0;u<t.length;u++)(!1&o||a>=o)&&Object.keys(r.O).every(p=>r.O[p](t[u]))?t.splice(u--,1):(c=!1,o<a&&(a=o));if(c){e.splice(i--,1);var d=f();void 0!==d&&(n=d)}}return n}o=o||0;for(var i=e.length;i>0&&e[i-1][2]>o;i--)e[i]=e[i-1];e[i]=[t,f,o]},r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},r.d=(e,n)=>{for(var t in n)r.o(n,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((n,t)=>(r.f[t](e,n),n),[])),r.u=e=>(592===e?"common":e)+"."+{103:"4a2aea63cc3bf42b",287:"63ace7ac80c3d9f2",386:"2404f3bc252e1df3",503:"6553f508f4a9247d",548:"e2df47ddad764d0b",592:"1fc175bce139f4df",688:"7032fddba7983cf6"}[e]+".js",r.miniCssF=e=>{},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={},n="blrec:";r.l=(t,f,o,i)=>{if(e[t])e[t].push(f);else{var a,c;if(void 0!==o)for(var u=document.getElementsByTagName("script"),d=0;d<u.length;d++){var l=u[d];if(l.getAttribute("src")==t||l.getAttribute("data-webpack")==n+o){a=l;break}}a||(c=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",n+o),a.src=r.tu(t)),e[t]=[f];var s=(g,p)=>{a.onerror=a.onload=null,clearTimeout(b);var _=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),_&&_.forEach(h=>h(p)),g)return g(p)},b=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),c&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:n=>n},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(f,o)=>{var i=r.o(e,f)?e[f]:void 0;if(0!==i)if(i)o.push(i[2]);else if(666!=f){var a=new Promise((l,s)=>i=e[f]=[l,s]);o.push(i[2]=a);var c=r.p+r.u(f),u=new Error;r.l(c,l=>{if(r.o(e,f)&&(0!==(i=e[f])&&(e[f]=void 0),i)){var s=l&&("load"===l.type?"missing":l.type),b=l&&l.target&&l.target.src;u.message="Loading chunk "+f+" failed.\n("+s+": "+b+")",u.name="ChunkLoadError",u.type=s,u.request=b,i[1](u)}},"chunk-"+f,f)}else e[f]=0},r.O.j=f=>0===e[f];var n=(f,o)=>{var u,d,[i,a,c]=o,l=0;if(i.some(b=>0!==e[b])){for(u in a)r.o(a,u)&&(r.m[u]=a[u]);if(c)var s=c(r)}for(f&&f(o);l<i.length;l++)r.o(e,d=i[l])&&e[d]&&e[d][0](),e[d]=0;return r.O(s)},t=self.webpackChunkblrec=self.webpackChunkblrec||[];t.forEach(n.bind(null,0)),t.push=n.bind(null,t.push.bind(t))})()})();
|
||||
(()=>{"use strict";var e,v={},m={};function r(e){var n=m[e];if(void 0!==n)return n.exports;var t=m[e]={exports:{}};return v[e](t,t.exports,r),t.exports}r.m=v,e=[],r.O=(n,t,f,o)=>{if(!t){var a=1/0;for(i=0;i<e.length;i++){for(var[t,f,o]=e[i],d=!0,u=0;u<t.length;u++)(!1&o||a>=o)&&Object.keys(r.O).every(p=>r.O[p](t[u]))?t.splice(u--,1):(d=!1,o<a&&(a=o));if(d){e.splice(i--,1);var c=f();void 0!==c&&(n=c)}}return n}o=o||0;for(var i=e.length;i>0&&e[i-1][2]>o;i--)e[i]=e[i-1];e[i]=[t,f,o]},r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},r.d=(e,n)=>{for(var t in n)r.o(n,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((n,t)=>(r.f[t](e,n),n),[])),r.u=e=>(592===e?"common":e)+"."+{103:"4a2aea63cc3bf42b",287:"d162f6c8e5d14fac",386:"2404f3bc252e1df3",503:"6553f508f4a9247d",548:"e2df47ddad764d0b",592:"1fc175bce139f4df",688:"7032fddba7983cf6"}[e]+".js",r.miniCssF=e=>{},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={},n="blrec:";r.l=(t,f,o,i)=>{if(e[t])e[t].push(f);else{var a,d;if(void 0!==o)for(var u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var l=u[c];if(l.getAttribute("src")==t||l.getAttribute("data-webpack")==n+o){a=l;break}}a||(d=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",n+o),a.src=r.tu(t)),e[t]=[f];var s=(g,p)=>{a.onerror=a.onload=null,clearTimeout(b);var _=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),_&&_.forEach(h=>h(p)),g)return g(p)},b=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),d&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:n=>n},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(f,o)=>{var i=r.o(e,f)?e[f]:void 0;if(0!==i)if(i)o.push(i[2]);else if(666!=f){var a=new Promise((l,s)=>i=e[f]=[l,s]);o.push(i[2]=a);var d=r.p+r.u(f),u=new Error;r.l(d,l=>{if(r.o(e,f)&&(0!==(i=e[f])&&(e[f]=void 0),i)){var s=l&&("load"===l.type?"missing":l.type),b=l&&l.target&&l.target.src;u.message="Loading chunk "+f+" failed.\n("+s+": "+b+")",u.name="ChunkLoadError",u.type=s,u.request=b,i[1](u)}},"chunk-"+f,f)}else e[f]=0},r.O.j=f=>0===e[f];var n=(f,o)=>{var u,c,[i,a,d]=o,l=0;if(i.some(b=>0!==e[b])){for(u in a)r.o(a,u)&&(r.m[u]=a[u]);if(d)var s=d(r)}for(f&&f(o);l<i.length;l++)r.o(e,c=i[l])&&e[c]&&e[c][0](),e[c]=0;return r.O(s)},t=self.webpackChunkblrec=self.webpackChunkblrec||[];t.forEach(n.bind(null,0)),t.push=n.bind(null,t.push.bind(t))})()})();
|
@ -9,11 +9,5 @@
|
||||
<nz-descriptions-item nzTitle="UID">{{
|
||||
userInfo.uid
|
||||
}}</nz-descriptions-item>
|
||||
<nz-descriptions-item nzTitle="等级">{{
|
||||
userInfo.level
|
||||
}}</nz-descriptions-item>
|
||||
<nz-descriptions-item nzTitle="签名">
|
||||
{{ userInfo.sign }}
|
||||
</nz-descriptions-item>
|
||||
</nz-descriptions>
|
||||
</nz-card>
|
||||
|
Loading…
Reference in New Issue
Block a user