py_bilibili2.py 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389
  1. D7='Referer'
  2. D6='liveapi2'
  3. D5='playUrl'
  4. D4='mimeType'
  5. D3='codecid'
  6. D2='192000'
  7. D1='media_ft'
  8. D0='media_bangumi'
  9. C_='stream'
  10. Cz='playurl_info'
  11. Cy='\u3000UID:'
  12. Cx='是否关注$ '
  13. Cw='vod_list'
  14. Cv='\u3000👥 '
  15. Cu='➖取关$2_notplay_follow'
  16. Ct='➕关注$1_notplay_follow'
  17. Cs='bilidanmu'
  18. Cr='setting'
  19. Cq='Reply_jump'
  20. Cp='https://b23.tv/'
  21. Co='message'
  22. Cn='totalrank'
  23. Cm='room_id'
  24. Cl='featured'
  25. Ck='favorite'
  26. Cj='attention'
  27. Ci='\u3000💬'
  28. Ch='videos'
  29. Cg=' 个人主页'
  30. Cf='quicksearch'
  31. Ce='oldest'
  32. Cd='user_cover'
  33. Cc='roomid'
  34. Cb='text_small'
  35. Ca='watched_show'
  36. CZ='live_status'
  37. CY='offset'
  38. CX='查看直播细化标签'
  39. CW='fav_list'
  40. CV='https://api.bilibili.com/x/web-interface/nav'
  41. CU='bangumi_pay_parse'
  42. CT='bangumi_vip_parse'
  43. CS='bangumi_horizontal_cover'
  44. CR='hide_bangumi_vip_badge'
  45. CQ='hide_bangumi_preview'
  46. CP='raw_cookie_vip'
  47. CO='raw_cookie_line'
  48. CL='header'
  49. CK='vodTMPQn'
  50. CJ='wts'
  51. CI='csrf'
  52. CH='dur'
  53. CG='playurl'
  54. CF='ver'
  55. CE='checkUpdate'
  56. CD='interaction'
  57. CC='vod_director'
  58. CB='vod_area'
  59. CA='vod_year'
  60. C9='title_type'
  61. C8='000'
  62. C7='bili_user'
  63. C6='sort'
  64. C5='season_status'
  65. C4='special'
  66. C3='悄悄关注'
  67. C2='最近关注'
  68. C1='bangumi'
  69. C0='coin'
  70. B_='like_num'
  71. Bz='part'
  72. By=' 💬'
  73. Bx='play'
  74. Bw='vod_pc'
  75. Bv='module_author'
  76. Bu='https://www.bilibili.com'
  77. Bt='isVIP'
  78. Bs='isLogin'
  79. Br='https://'
  80. Bq='每周必看'
  81. Bp='排行榜'
  82. Bo='showLiveFilterTag'
  83. Bn='vodDefaultCodec'
  84. Bm='favMode'
  85. Bl='maxHomeVideoContent'
  86. Bk='currentVersion'
  87. Bj=round
  88. Bf='audio'
  89. Be='format'
  90. Bd='codec'
  91. Bc='status'
  92. Bb='vod_actor'
  93. Ba='redirect_url'
  94. BZ='edgeid'
  95. BY='$ '
  96. BX='BV'
  97. BW='all'
  98. BV='最近访问'
  99. BU='最常访问'
  100. BT='稍后再看'
  101. BS='vod_count'
  102. BR='episodes'
  103. BQ='stat'
  104. BP=' ▶'
  105. BO='content'
  106. BN='archive'
  107. BM='UP主'
  108. BL='modules'
  109. BK='items'
  110. BJ='分区'
  111. BI='type_name'
  112. BH='搜索'
  113. BG='历史'
  114. BF='关注'
  115. BE='rankingLis'
  116. BD='tuijianLis'
  117. BC='heartbeatInterval'
  118. BB=float
  119. BA=open
  120. B9='contentType'
  121. B8='s_title'
  122. B7='graph_version'
  123. B6='fromep'
  124. B5='ssid'
  125. B4='seasons'
  126. B3='特别关注'
  127. B2='正在直播'
  128. B1='like'
  129. B0='new_ep'
  130. A_='index_show'
  131. Az='view'
  132. Ay='pic'
  133. Ax='keyword'
  134. Aw='channel_list'
  135. Av='userid'
  136. Au='utf-8'
  137. At='cateManual'
  138. As='show_vod_hot_reply'
  139. Ar='vodDefaultAudio'
  140. Aq='vodDefaultQn'
  141. Ap='@@@'
  142. Ao='season_title'
  143. An='parse'
  144. Am='Reply'
  145. Al='danmaku'
  146. Ak='fans'
  147. Aj='following'
  148. Ai='pubdate'
  149. Ah=' 🆙'
  150. Ag='mlid'
  151. Af='收藏'
  152. Ae='频道'
  153. Ad='影视'
  154. Ac='vod_content'
  155. Ab='\u3000'
  156. Aa='desc'
  157. AZ='up'
  158. AY='season_id'
  159. AX='owner'
  160. AW='live'
  161. AV='4'
  162. AU=None
  163. AT='cateLive'
  164. AS='vip'
  165. AR='3'
  166. AP='newVersion'
  167. AO='vod_play_url'
  168. AN='vod_play_from'
  169. AM='result'
  170. AL=' '
  171. AK='"'
  172. AJ='"'
  173. AI='动态'
  174. AH='直播'
  175. AG='推荐'
  176. AF=True
  177. AE='_tmp'
  178. AD='﹩'
  179. AC='﹟'
  180. AB='video'
  181. AA='/'
  182. A9='User-Agent'
  183. A8='uname'
  184. A7='face'
  185. A6='UP'
  186. A5='cateManualLiveExtra'
  187. A4='cookies_dic'
  188. A3=dict
  189. A2='tid'
  190. A1='2'
  191. A0='ep'
  192. z='cateManualLive'
  193. y='热门'
  194. w='$'
  195. v='av'
  196. u='limit'
  197. t='pagecount'
  198. s=list
  199. r='type'
  200. q='ss'
  201. p='total'
  202. o='url'
  203. n='cid'
  204. m='id'
  205. l='</em>'
  206. k='<em class="keyword">'
  207. i='cover'
  208. h='page'
  209. g='master'
  210. f=map
  211. e='$$$'
  212. d='duration'
  213. c='users'
  214. b='order'
  215. a='aid'
  216. Z='filter'
  217. Y='page_size'
  218. X='vod_remarks'
  219. W='mid'
  220. V=len
  221. U='vod_pic'
  222. T='1'
  223. S='key'
  224. R='title'
  225. Q='vod_id'
  226. P='fake'
  227. O='vod_name'
  228. N='#'
  229. M='code'
  230. L='0'
  231. G='value'
  232. K='_'
  233. J='name'
  234. H='list'
  235. F=int
  236. E='data'
  237. D='n'
  238. C='v'
  239. B=''
  240. A=str
  241. import sys,os,json as I
  242. from base.spider import Spider
  243. from requests import session as Bg,utils as Bh,get as CM
  244. from requests.adapters import HTTPAdapter as D8,Retry
  245. from concurrent.futures import ThreadPoolExecutor as D9,as_completed as Bi
  246. import threading as j,hashlib,time as x,random
  247. from functools import reduce
  248. from urllib.parse import quote,urlencode as CN
  249. sys.path.append('..')
  250. AQ,DA=os.path.split(os.path.abspath(__file__))
  251. sys.path.append(AQ)
  252. class Spider(Spider):
  253. defaultConfig={Bk:'20231004_1',CO:B,CP:B,Bl:AR,Bm:L,Y:10,BC:'15',Aq:'80',Bn:'7',Ar:'30280',As:AF,CQ:AF,CR:AF,CS:AF,CT:AF,CU:AF,Bo:L,At:[AG,Ad,AH,AI,Ae,Af,BF,BG,BH],BD:[AG,y,Bp,Bq,'入站必刷','番剧时间表','国创时间表'],BE:['动画','音乐','舞蹈','游戏','鬼畜','知识','科技','运动','生活','美食','动物','汽车','时尚','娱乐',Ad,'原创','新人']}
  254. focus_on_up_list=[{"n":"LexBurner", "v":"777536"},{"n":"真栗", "v":"210752"},{"n":"黑色脑回路", "v":"121895315"},{"n":"JOKER鹏少", "v":"92678046"}]
  255. focus_on_search_key=['经典无损音乐合集','帕梅拉','太极拳','健身','舞蹈','音乐','歌曲','MV4K','演唱会4K','白噪音4K','知名UP主','说案','解说','演讲','探索发现超清','纪录片超清','平面设计教学','软件教程','实用教程','旅游','风景4K','食谱','美食超清','搞笑','球星','动物世界超清','相声小品','戏曲','儿童','小姐姐4K','荒野求生超清']
  256. def getName(A):return'哔哩哔哩'
  257. def load_config(A):
  258. try:
  259. with BA(f"{AQ}/config.json",encoding=Au)as D:A.userConfig=I.load(D)
  260. E={g:'cookie_dic',AS:'cookie_vip_dic',P:'cookie_fake_dic'}
  261. for(F,C)in E.items():
  262. C=A.userConfig.get(C)
  263. if C:
  264. if not A.userConfig.get(c):A.userConfig[c]={}
  265. A.userConfig[c][F]={A4:C}
  266. B=A.userConfig.get(c,{})
  267. if B.get(g)and B[g].get(A4):A.session_master.cookies=Bh.cookiejar_from_dict(B[g][A4]);A.userid=B[g][Av]
  268. if B.get(P)and B[P].get(A4):A.session_fake.cookies=Bh.cookiejar_from_dict(B[P][A4])
  269. except:A.userConfig={}
  270. A.userConfig={**A.defaultConfig,**A.userConfig}
  271. dump_config_lock=j.Lock()
  272. def dump_config(A):
  273. F=[c,Aw,AT,z,A5];C={}
  274. for(B,D)in A.userConfig.items():
  275. E=A.defaultConfig.get(B)
  276. if E!=AU and D!=E or B in F:C[B]=D
  277. A.dump_config_lock.acquire()
  278. with BA(f"{AQ}/config.json",'w',encoding=Au)as G:H=I.dumps(C,indent=1,ensure_ascii=False);G.write(H)
  279. A.dump_config_lock.release()
  280. pool=D9(max_workers=8);task_pool=[]
  281. def homeContent(A,filter):
  282. A.pool.submit(A.add_live_filter);A.pool.submit(A.add_channel_filter);A.pool.submit(A.add_search_key);A.pool.submit(A.add_focus_on_up_filter);A.pool.submit(A.get_tuijian_filter);A.pool.submit(A.add_fav_filter);F=[Ae,AI,Af,BF,BG];B=A.userConfig[At]
  283. if not A.userid and not A6 in B or not AI in B and not A6 in B:B+=[A6]
  284. D=[]
  285. for C in B:
  286. if C in F and not A.userid:continue
  287. D.append({BI:C,'type_id':C})
  288. A.add_focus_on_up_filter_event.wait()
  289. if A6 in B:A.config[Z].update({A6:A.config[Z].pop(AI)})
  290. E={'class':D};A.add_live_filter_event.wait();A.add_channel_filter_event.wait();A.add_fav_filter_event.wait();A.add_search_key_event.wait()
  291. if filter:E['filters']=A.config[Z]
  292. A.pool.submit(A.dump_config);A.pool.submit(A._checkUpdate,L);return E
  293. userid=csrf=B;session_master=Bg();session_vip=Bg();session_fake=Bg();con=j.Condition();getCookie_event=j.Event();retries=Retry(total=5,backoff_factor=.1);adapter=D8(max_retries=retries);session_master.mount(Br,adapter);session_vip.mount(Br,adapter);session_fake.mount(Br,adapter)
  294. def getCookie_dosth(B,co):
  295. A=co.strip().split('=',1)
  296. if not'%'in A[1]:A[1]=quote(A[1])
  297. return A
  298. def getCookie(A,_type=g):
  299. D=_type;G=CO
  300. if D==AS:G=CP
  301. G=A.userConfig.get(G);K=A.userConfig.get(c,{});C=K.get(D,{})
  302. if not G and not C:
  303. if D==g:A.getCookie_event.set()
  304. with A.con:A.con.notifyAll()
  305. return
  306. J=C.get(A4,{})
  307. if G:J=A3(f(A.getCookie_dosth,G.split(';')))
  308. L=Bh.cookiejar_from_dict(J);N=CV;O=A.fetch(N,headers=A.header,cookies=L);H=I.loads(O.text);C[Bs]=0
  309. if H[M]==0:
  310. C[Bs]=1;C[Av]=H[E][W];C[A7]=H[E][A7];C[A8]=H[E][A8];C[A4]=J;C[Bt]=F(H[E]['vipStatus'])
  311. if D==g:A.session_master.cookies=L;A.userid=C[Av];A.csrf=J['bili_jct']
  312. if C[Bt]:A.session_vip.cookies=L
  313. else:A.userid=B
  314. K[D]=C
  315. with A.con:
  316. if V(C)>1:A.userConfig.update({c:K})
  317. if D==g:A.getCookie_event.set()
  318. getFakeCookie_event=j.Event()
  319. def getFakeCookie(A,fromSearch=AU):
  320. if A.session_fake.cookies:A.getFakeCookie_event.set()
  321. C={};C[A9]=A.header[A9];B=A.fetch(Bu,headers=C);A.session_fake.cookies=B.cookies;A.getFakeCookie_event.set()
  322. with A.con:D=A.userConfig.get(c,{});D[P]={A4:A3(B.cookies)};A.userConfig.update({c:D})
  323. if not fromSearch:
  324. A.getCookie_event.wait()
  325. if not A.session_master.cookies:A.session_master.cookies=B.cookies
  326. def get_fav_list_dict(E,fav):A={D:fav[R].replace(k,B).replace(l,B).replace(AJ,AK).strip(),C:fav[m]};return A
  327. add_fav_filter_event=j.Event()
  328. def add_fav_filter(B):
  329. N=B.userConfig.get(c,{})
  330. if N.get(g)and N[g].get(Av):F=B.userConfig[c][g][Av]
  331. else:B.getCookie_event.wait();F=B.userid
  332. K=[]
  333. if F:
  334. P='https://api.bilibili.com/x/v3/fav/folder/created/list-all?up_mid=%s&jsonp=jsonp'%A(F);Q=B._get_sth(P);L=I.loads(Q.text)
  335. if L[M]==0 and L.get(E):R=L[E].get(H);K=s(f(B.get_fav_list_dict,R))
  336. U=[{D:'追番',C:T},{D:'追剧',C:A1}];O=B.config[Z].get(Af)
  337. if O:O.insert(0,{S:Ag,J:BJ,G:U+K})
  338. B.add_fav_filter_event.set();B.userConfig[CW]=K
  339. def get_channel_list_dict(F,channel):A=channel;E={D:A[J].replace(k,B).replace(l,B).replace(AJ,AK).strip(),C:A[m]};return E
  340. def get_channel_list(A):
  341. C='https://api.bilibili.com/x/web-interface/web/channel/category/channel/list?id=100&offset=0&page_size=15';D=A._get_sth(C,P);B=I.loads(D.text);G=[]
  342. if B[M]==0:F=B[E].get('channels');A.userConfig[Aw]=s(f(A.get_channel_list_dict,F))
  343. return A.userConfig[Aw]
  344. add_channel_filter_event=j.Event()
  345. def add_channel_filter(A):
  346. C=A.userConfig.get(Aw,B);E=A.pool.submit(A.get_channel_list)
  347. if not C:C=E.result()
  348. D=A.config[Z].get(Ae,[])
  349. if D:D.insert(0,{S:n,J:BJ,G:C})
  350. A.config[Z][Ae]=D;A.add_channel_filter_event.set()
  351. add_focus_on_up_filter_event=j.Event()
  352. def add_focus_on_up_filter(B):
  353. P='上个视频的UP主';N=[{D:P,C:P}];F=[]
  354. if not B.session_master.cookies:B.getCookie_event.wait()
  355. if B.session_master.cookies:
  356. Q='https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=video&page=1';R=B._get_sth(Q);H=I.loads(R.text)
  357. if H[M]==0 and H.get(E):T=H[E].get(BK,[]);F=s(f(lambda x:{D:x[BL][Bv][J],C:A(x[BL][Bv][W])},T));N.insert(0,{D:'我的动态',C:L})
  358. if V(B.focus_on_up_list)>0:
  359. U=s(f(lambda x:x[C],B.focus_on_up_list))
  360. for O in F:
  361. if O[C]in U:F.remove(O)
  362. F.extend(B.focus_on_up_list)
  363. X=[{D:'登录与设置',C:'登录'}];F=N+F+X;K=B.config[Z].get(AI,[])
  364. if K:K.insert(0,{S:W,J:BM,G:F})
  365. B.config[Z][AI]=K;B.add_focus_on_up_filter_event.set()
  366. def get_live_parent_area_list(N,parent_area):B=parent_area;E=B[J];id=A(B[m]);F=B[H];I=s(f(lambda area:{D:area[J],C:A(area['parent_id'])+K+A(area[m])},F));L={S:A2,J:E,G:I};M={m:id+'_0',G:L};return E,M
  367. def get_live_list(A):
  368. C='https://api.live.bilibili.com/xlive/web-interface/v1/index/getWebAreaList?source_id=2';D=A._get_sth(C,P);B=I.loads(D.text);G={}
  369. if B[M]==0:F=B[E][E];A.userConfig[AT]=A3(A.pool.map(A.get_live_parent_area_list,F))
  370. return A.userConfig[AT]
  371. def set_default_cateManualLive(A):
  372. B=[{D:AG,C:AG},{D:y,C:y}]
  373. for E in A.userConfig[AT]:F={D:E,C:A.userConfig[AT][E][m]};B.append(F)
  374. A.defaultConfig[z]=B;return B
  375. add_live_filter_event=j.Event()
  376. def add_live_filter(A):
  377. C=A.userConfig.get(AT,{});E=A.pool.submit(A.get_live_list)
  378. if not C:C=E.result()
  379. H=A.pool.submit(A.set_default_cateManualLive);A.config[Z][AH]=[];B=A.userConfig.get(z,[])
  380. if not B:B=H.result()
  381. if B:I={S:A2,J:BJ,G:B};A.config[Z][AH].append(I)
  382. if F(A.userConfig[Bo]):
  383. for D in C.values():
  384. if V(D[G][G])==1:continue
  385. A.config[Z][AH].append(D[G])
  386. A.add_live_filter_event.set()
  387. add_search_key_event=j.Event()
  388. def add_search_key(A):
  389. B=A.focus_on_search_key;L='https://api.bilibili.com/x/web-interface/search/square?limit=10&platform=web';N=A._get_sth(L,P);F=I.loads(N.text);Q={}
  390. if F[M]==0:O=F[E]['trending'].get(H,[]);B+=s(f(lambda x:x[Ax],O))
  391. K={S:Ax,J:'搜索词',G:[]};K[G]=s(f(lambda i:{D:i,C:i},B));A.config[Z][BH].insert(0,K);A.add_search_key_event.set()
  392. def get_tuijian_filter(E):
  393. K={'番剧时间表':'10001','国创时间表':'10004',Bp:L,'动画':T,'音乐':AR,'舞蹈':'129','游戏':AV,'鬼畜':'119','知识':'36','科技':'188','运动':'234','生活':'160','美食':'211','动物':'217','汽车':'223','时尚':'155','娱乐':'5',Ad:'181','原创':'origin','新人':'rookie'};M=[{D:BD,C:BJ},{D:BE,C:Bp}];F=[]
  394. for H in M:
  395. I={S:A2,J:H[C],G:[]};N=E.userConfig.get(H[D],[])
  396. for A in N:
  397. B=K.get(A)
  398. if not B:B=A
  399. O={D:A,C:B};I[G].append(O)
  400. F.append(I)
  401. E.config[Z][AG]=F
  402. def __init__(A):A.load_config();A.pool.submit(A.getCookie);A.pool.submit(A.getFakeCookie);A.pool.submit(A.getCookie,AS)
  403. def init(A,extend=B):print('============{0}============'.format(extend))
  404. def isVideoFormat(A,url):0
  405. def manualVideoCheck(A):0
  406. def format_img(B,img):
  407. A=img;A+='@672w_378h_1c.webp'
  408. if not A.startswith('http'):A='https:'+A
  409. return A
  410. def pagination(A,array,pg):B=A.userConfig[Y]*F(pg);C=B-A.userConfig[Y];return array[C:B]
  411. def zh(D,num):
  412. C=num
  413. if F(C)>=100000000:B=Bj(BB(C)/BB(100000000),1);B=A(B)+'亿'
  414. elif F(C)>=10000:B=Bj(BB(C)/BB(10000),1);B=A(B)+'万'
  415. else:B=A(C)
  416. return B
  417. def second_to_time(D,a):
  418. a=F(a)
  419. if a<3600:C=x.strftime('%M:%S',x.gmtime(a))
  420. else:C=x.strftime('%H:%M:%S',x.gmtime(a))
  421. if A(C).startswith(L):C=A(C).replace(L,B,1)
  422. return C
  423. def str2sec(E,x):
  424. x=A(x)
  425. try:D,B,C=x.strip().split(':');return F(D)*3600+F(B)*60+F(C)
  426. except:B,C=x.strip().split(':');return F(B)*60+F(C)
  427. def filter_duration(B,vodlist,key):
  428. D=vodlist;C=key
  429. if C==L:return D
  430. else:E=[D for D in D if B.time_diff1[C][0]<=B.str2sec(A(D[X]))<B.time_diff1[C][1]];return E
  431. def find_bangumi_id(C,url):
  432. B=A(url).strip().split(AA)[-1]
  433. if not B:B=A(url).strip().split(AA)[-2]
  434. B=B.split('?')[0];return B
  435. def get_Login_qrcode(D,pg):
  436. R='setting_login_';N='https://www.bilibili.com/favicon.ico';A={}
  437. if F(pg)!=1:return A
  438. G=[{Q:'setting_tab&filter',O:'标签与筛选',U:N},{Q:'setting_liveExtra',O:CX,U:N}];K='https://passport.bilibili.com/x/passport-login/web/qrcode/generate';S=D._get_sth(K,P);J=I.loads(S.text)
  439. if J[M]==0:
  440. id=J[E]['qrcode_key'];K=J[E][o];T={g:'主账号',AS:'副账号'};V={0:'未登录',1:'已登录'};W={0:B,1:'👑'};Y=D.userConfig.get(c,{})
  441. for(Z,a)in T.items():
  442. C=Y.get(Z)
  443. if C:G.append({Q:R+id,O:C[A8],U:D.format_img(C[A7]),X:W[C[Bt]]+a+AL+V[C[Bs]]})
  444. L={'qrcode':'https://passport.bilibili.com/h5-app/passport/login/scan?qrcode_key='+id+'&navhide=1'};L['qr_chs']='208x117';G.append({Q:R+id,U:'http://jm92swf.s1002.xrea.com/?'+CN(L)})
  445. A[H]=G;A[h]=1;A[t]=1;A[u]=1;A[p]=1;return A
  446. time_diff1={T:[0,300],A1:[300,900],AR:[900,1800],AV:[1800,3600],'5':[3600,0x4ee2d6d415b85acef80ffffffff]};time_diff=L;dynamic_offset=B
  447. def get_dynamic(C,pg,mid,order):
  448. if mid==L:
  449. D={}
  450. if F(pg)==1:C.dynamic_offset=B
  451. S='https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=video&offset=%s&page=%s'%(C.dynamic_offset,pg);T=C._get_sth(S);K=I.loads(T.text)
  452. if K[M]==0:
  453. C.dynamic_offset=K[E].get(CY);P=[];V=K[E][BK]
  454. for N in V:
  455. if not N['visible']:continue
  456. W=N[BL][Bv][J];G=N[BL]['module_dynamic']['major'][BN];Y=A(G[a]).strip();Z=G[R].strip().replace(k,B).replace(l,B);b=G[i].strip();c=A(C.second_to_time(C.str2sec(G['duration_text']))).strip()+Ah+A(W).strip();P.append({Q:v+Y,O:Z,U:C.format_img(b),X:c})
  457. D[H]=P;D[h]=pg;D[t]=9999;D[u]=99;D[p]=999999
  458. return D
  459. else:return C.get_up_videos(mid=mid,pg=pg,order=order)
  460. def get_found_vod(D,vod):
  461. C=vod;E=C.get(a,B)
  462. if not E:E=C.get(m,B)
  463. F=C.get('goto',B)
  464. if not F or F and F==v:E=v+A(E).strip()
  465. elif F=='ad':return[]
  466. M=C[R].strip();N=C[Ay].strip();P=C.get('is_followed')
  467. if F==AW:
  468. K=C['room_info'];H=B;S=K.get(CZ,B)
  469. if S:H='直播中 '
  470. else:return[]
  471. H+='👁'+K[Ca][Cb]+Ah+C[AX][J].strip()
  472. else:
  473. I=C.get('rcmd_reason',B)
  474. if I and type(I)==A3 and I.get(BO):
  475. G=' 🔥'+I[BO].strip()
  476. if'人气飙升'in G:G=' 🔥人气飙升'
  477. elif P:G=' 已关注'
  478. else:G=Ah+C[AX][J].strip()
  479. H=A(D.second_to_time(C[d])).strip()+BP+D.zh(C[BQ][Az])+G
  480. L=[{Q:E,O:M,U:D.format_img(N),X:H}]
  481. for T in D.pool.map(D.get_found_vod,C.get('others',[])):L.extend(T)
  482. return L
  483. _popSeriesInit=0
  484. def get_found(B,tid,rid,pg):
  485. J=pg;G=tid;K={}
  486. if G==AG:T=B.encrypt_wbi(fresh_type=4,feed_version='V3',brush=1,fresh_idx=J,fresh_idx_1h=J,ps=B.userConfig[Y]);C=f"https://api.bilibili.com/x/web-interface/wbi/index/top/feed/rcmd?{T}"
  487. else:
  488. C='https://api.bilibili.com/x/web-interface/ranking/v2?rid={0}&type={1}'.format(rid,G)
  489. if G==y:C='https://api.bilibili.com/x/web-interface/popular?pn={0}&ps={1}'.format(J,B.userConfig[Y])
  490. elif G=='入站必刷':C='https://api.bilibili.com/x/web-interface/popular/precious'
  491. elif G==Bq:
  492. if not B._popSeriesInit or F(J)==1:C='https://api.bilibili.com/x/web-interface/popular/series/list';Q=B._get_sth(C,P);L=I.loads(Q.text);N=B._popSeriesInit=L[E][H][0]['number'];B._popSeriesNum=[F(N),1]
  493. else:N=B._popSeriesNum[0]
  494. C='https://api.bilibili.com/x/web-interface/popular/series/one?number='+A(N)
  495. Q=B._get_sth(C);L=I.loads(Q.text)
  496. if L[M]==0:
  497. S=[];D=L[E].get('item')
  498. if not D:D=L[E][H]
  499. if V(D)>B.userConfig[Y]:
  500. if G==Bq:
  501. O=F(B._popSeriesNum[1]);R=V(D)/B.userConfig[Y]-O
  502. if R>0:R+=1
  503. if not F(R):B._popSeriesNum=[F(N)-1,1]
  504. else:B._popSeriesNum[1]=O+1
  505. else:O=J
  506. D=B.pagination(D,O)
  507. for U in B.pool.map(B.get_found_vod,D):S.extend(U)
  508. K[H]=S;K[h]=J;K[t]=9999;K[u]=99;K[p]=999999
  509. return K
  510. def get_bangumi(D,tid,pg,order,season_status):
  511. a='first_ep';Z='first_ep_info';W=order;G=tid;J={}
  512. if W=='追番剧':K='https://api.bilibili.com/x/space/bangumi/follow/list?type={0}&vmid={1}&pn={2}&ps={3}'.format(G,D.userid,pg,D.userConfig[Y]);b=D._get_sth(K)
  513. else:
  514. K='https://api.bilibili.com/pgc/season/index/result?type=1&season_type={0}&page={1}&order={2}&season_status={3}&pagesize={4}'.format(G,pg,W,season_status,D.userConfig[Y])
  515. if W==y:
  516. if G==T:K='https://api.bilibili.com/pgc/web/rank/list?season_type={0}&day=3'.format(G)
  517. else:K='https://api.bilibili.com/pgc/season/rank/web/list?season_type={0}&day=3'.format(G)
  518. b=D._get_sth(K,P)
  519. S=I.loads(b.text)
  520. if S[M]==0:
  521. if E in S:L=S[E][H]
  522. else:L=S[AM][H]
  523. if V(L)>D.userConfig[Y]:L=D.pagination(L,pg)
  524. c=[]
  525. for C in L:
  526. e=A(C[AY]).strip();f=C[R];N=C.get('ss_horizontal_cover')
  527. if not N or G==T and not D.userConfig[CS]:
  528. if C.get(Z)and i in C[Z]:N=C[Z][i]
  529. elif C.get(a)and i in C[a]:N=C[a][i]
  530. else:N=C[i].strip()
  531. F=C.get(A_,B)
  532. if not F and C.get(B0)and C[B0].get(A_):F=C[B0][A_]
  533. F=F.replace('更新至','🆕');d=C.get(BQ)
  534. if d:F='▶'+D.zh(d.get(Az))+' '+F
  535. c.append({Q:q+e,O:f,U:D.format_img(N),X:F})
  536. J[H]=c;J[h]=pg;J[t]=9999;J[u]=90;J[p]=999999
  537. return J
  538. def get_timeline(E,tid,pg):
  539. a='pub_index';Z='ep_cover';D={};b='https://api.bilibili.com/pgc/web/timeline/v2?season_type={0}&day_before=2&day_after=4'.format(tid);c=E._get_sth(b,P);d=c.text;F=I.loads(d)
  540. if F[M]==0:
  541. T=[];G=F[AM]['latest']
  542. for C in G:J=A(C[AY]).strip();K=C[R].strip();N=C[Z].strip();S='🆕'+C[a]+' ❤ '+C['follows'].replace('系列',B).replace('追番',B);T.append({Q:q+J,O:K,U:E.format_img(N),X:S})
  543. W=[];Y=F[AM]['timeline']
  544. for e in range(V(Y)):
  545. G=Y[e][BR]
  546. for C in G:
  547. if A(C['published'])==L:J=A(C[AY]).strip();K=A(C[R]).strip();N=A(C[Z]).strip();f=A(x.strftime('%m-%d %H:%M',x.localtime(C['pub_ts'])));S=f+' '+C[a];W.append({Q:q+J,O:K,U:E.format_img(N),X:S})
  548. D[H]=W+T;D[h]=1;D[t]=1;D[u]=90;D[p]=999999
  549. return D
  550. def get_live(G,pg,parent_area_id,area_id):
  551. V='recommend_room_list';K=parent_area_id;D={}
  552. if K==AG:J='https://api.live.bilibili.com/xlive/web-interface/v1/webMain/getList?platform=web&page=%s'%pg;N=G._get_sth(J)
  553. else:
  554. J='https://api.live.bilibili.com/xlive/web-interface/v1/second/getList?platform=web&parent_area_id=%s&area_id=%s&sort_type=online&page=%s'%(K,area_id,pg)
  555. if K==y:J='https://api.live.bilibili.com/room/v1/room/get_user_recommend?page=%s&page_size=%s'%(pg,G.userConfig[Y])
  556. N=G._get_sth(J,P)
  557. S=I.loads(N.text)
  558. if S[M]==0:
  559. T=[];C=S[E]
  560. if V in C:C=C[V]
  561. elif H in C:C=C[H]
  562. for F in C:
  563. W=A(F[Cc]).strip();Z=F[R].replace(k,B).replace(l,B).replace(AJ,AK);L=F.get(Cd)
  564. if not L:L=F.get(i)
  565. a='👁'+F[Ca][Cb].strip()+Ah+F[A8].strip();T.append({Q:W,O:Z,U:G.format_img(L),X:a})
  566. D[H]=T;D[h]=pg;D[t]=9999;D[u]=99;D[p]=999999
  567. return D
  568. get_up_videos_result={}
  569. def get_up_videos(C,mid,pg,order):
  570. S=order;L=pg;D=mid;G={}
  571. if not D.isdigit():
  572. if F(L)==1:
  573. C.get_up_videos_mid=D=C.detailContent_args.get(W,B)
  574. if not D in C.get_up_videos_result:C.get_up_videos_result.clear();C.get_up_videos_result[D]=[]
  575. else:D=C.get_up_videos_mid
  576. if F(L)==1:C.get_up_info_event.clear();C.pool.submit(C.get_up_info,D)
  577. T=V=B
  578. if S==Ce:V=S;S=Ai
  579. elif S==Cf:
  580. T='投稿: ';K=C.get_up_videos_result.get(D,[])
  581. if K:G[H]=K;return G
  582. Z=L
  583. if V:C.get_up_info_event.wait();Z=C.up_info[D][Bw]-F(L)+1
  584. e=C.encrypt_wbi(mid=D,pn=Z,ps=C.userConfig[Y],order=S);f=f"https://api.bilibili.com/x/space/wbi/arc/search?{e}";g=C._get_sth(f,P);i=g.text;b=I.loads(i);K=[]
  585. if b[M]==0:
  586. j=b[E][H]['vlist']
  587. for N in j:
  588. m=A(N[a]).strip();n=N[R].strip().replace(k,B).replace(l,B);o=N[Ay].strip();c=C.second_to_time(C.str2sec(A(N['length']).strip()))+BP+C.zh(N[Bx])
  589. if not T:c+=By+C.zh(N['video_review'])
  590. K.append({Q:v+m,O:T+n,U:C.format_img(o),X:c})
  591. if V:K.reverse()
  592. if F(L)==1:
  593. C.get_up_info_event.wait();d=C.up_info[D][J]+Cg
  594. if T:d='UP: '+C.up_info[D][J]
  595. q={Q:AZ+A(D),O:d,U:C.format_img(C.up_info[D][A7]),X:C.up_info[D][Aj]+' 👥'+C.up_info[D][Ak]+' 🎬'+A(C.up_info[D][BS])};K.insert(0,q)
  596. if T:C.get_up_videos_result[D]=K
  597. G[H]=K;G[h]=L;G[t]=99;G[u]=99;G[p]=999999
  598. return G
  599. history_view_at=0
  600. def get_history(D,type,pg):
  601. W='progress';G={}
  602. if F(pg)==1:D.history_view_at=0
  603. Z='https://api.bilibili.com/x/web-interface/history/cursor?ps={0}&view_at={1}&type={2}'.format(D.userConfig[Y],D.history_view_at,type)
  604. if type==BT:Z='https://api.bilibili.com/x/v2/history/toview'
  605. e=D._get_sth(Z);T=I.loads(e.text)
  606. if T[M]==0:
  607. b=[];V=T[E].get(H,[])
  608. if type==BT:V=D.pagination(V,pg)
  609. else:D.history_view_at=T[E]['cursor']['view_at']
  610. for C in V:
  611. J=C.get('history',B)
  612. if J:K=J['business'];N=A(J['oid']).strip();c=C[i].strip();S=A(J[Bz]).strip()
  613. else:K=BN;N=A(C[a]).strip();c=C[Ay].strip();S=A(C[h][Bz]).strip()
  614. if K=='article':continue
  615. elif K=='pgc':N=A0+A(J['epid']);d=C[p];S=C.get('show_title')
  616. elif K==BN:N=v+N;d=C[Ch]
  617. f=C[R].replace(k,B).replace(l,B).replace(AJ,AK)
  618. if K==AW:g=C.get('badge',B);P=g+Ah+C['author_name'].strip()
  619. else:
  620. if A(C[W])=='-1':P='已看完'
  621. elif A(C[W])==L:P='刚开始看'
  622. else:j=A(D.second_to_time(C[W])).strip();P='看到 '+j
  623. if not d in[0,1]and S:P+=' ('+A(S)+')'
  624. b.append({Q:N,O:f,U:D.format_img(c),X:P})
  625. G[H]=b;G[h]=pg;G[t]=9999;G[u]=90;G[p]=999999
  626. return G
  627. def get_fav_detail(F,pg,mlid,order):
  628. K='cnt_info';D={};L='https://api.bilibili.com/x/v3/fav/resource/list?media_id=%s&order=%s&pn=%s&ps=10&platform=web&type=0'%(mlid,order,pg);N=F._get_sth(L);P=N.text;G=I.loads(P)
  629. if G[M]==0:
  630. J=[];S=G[E].get('medias',[])
  631. for C in S:
  632. if C.get(r)in[2]and C.get(R)!='已失效视频':T=A(C[m]).strip();V=C[R].replace(k,B).replace(l,B).replace(AJ,AK);W=C[i].strip();Y=A(F.second_to_time(C[d])).strip()+BP+F.zh(C[K][Bx])+Ci+F.zh(C[K][Al]);J.append({Q:v+T+'_mlid'+A(mlid),O:V,U:F.format_img(W),X:Y})
  633. D[H]=J;D[h]=pg;D[t]=9999;D[u]=99;D[p]=999999
  634. return D
  635. get_up_info_event=j.Event();up_info={}
  636. def get_up_info(D,mid,**P):
  637. O='Official';K=mid
  638. if K in D.up_info:D.get_up_info_event.set()
  639. G=P.get(E)
  640. if not G:
  641. Q='https://api.bilibili.com/x/web-interface/card?mid={0}'.format(K);S=D._get_sth(Q);L=I.loads(S.text)
  642. if L[M]==0:G=L[E]
  643. else:D.get_up_info_event.set();return
  644. H=G['card'];C={};C[Aj]='未关注'
  645. if G[Aj]:C[Aj]='已关注'
  646. C[J]=H[J].replace(k,B).replace(l,B);C[A7]=H[A7];C[Ak]=D.zh(H[Ak]);C[B_]=D.zh(G[B_]);C[BS]=A(G['archive_count']).strip();C[Aa]=H[O][Aa]+Ab+H[O][R];N=divmod(F(C[BS]),D.userConfig[Y]);C[Bw]=N[0]
  647. if N[1]!=0:C[Bw]+=1
  648. D.up_info[K]=C;D.get_up_info_event.set()
  649. def get_vod_relation(H,id):
  650. if id.isdigit():F='aid='+A(id)
  651. elif'='in id:F=id
  652. else:F='bvid='+id
  653. J='https://api.bilibili.com/x/web-interface/archive/relation?'+F;K=H._get_sth(J);B=I.loads(K.text);C=[]
  654. if B[M]==0:
  655. B=B[E]
  656. if B[Cj]:C.append('已关注')
  657. else:C.append('未关注')
  658. D=[]
  659. if B[Ck]:D.append('⭐')
  660. if B[B1]:D.append('👍')
  661. G=B.get(C0)
  662. if G:D.append('💰'*G)
  663. if V(D)==3:C.append('👍💰⭐')
  664. else:C.extend(D)
  665. if B['dislike']:C.append('👎')
  666. if B['season_fav']:C.append('已订阅合集')
  667. return C
  668. def get_channel(C,pg,cid,order):
  669. P=order;N='uri';F={}
  670. if A(pg)==T:C.channel_offset=B
  671. if P==Cl:R='https://api.bilibili.com/x/web-interface/web/channel/featured/list?channel_id={0}&filter_type=0&offset={1}&page_size={2}'.format(cid,C.channel_offset,C.userConfig[Y])
  672. else:R='https://api.bilibili.com/x/web-interface/web/channel/multiple/list?channel_id={0}&sort_type={1}&offset={2}&page_size={3}'.format(cid,P,C.channel_offset,C.userConfig[Y])
  673. c=C._get_sth(R,g);L=I.loads(c.text)
  674. if L.get(M)==0:
  675. C.channel_offset=L[E].get(CY);S=[];G=L[E][H]
  676. if pg==T and BK in G[0]:e=G[0][BK];del G[0];G=e+G
  677. for D in G:
  678. if N in D and C1 in D[N]:V=C.find_bangumi_id(D[N])
  679. else:V=v+A(D[m]).strip()
  680. f=D[J].replace(k,B).replace(l,B).replace(AJ,AK);j=D[i].strip();K='▶'+A(D['view_count']);W=D.get(d,B)
  681. if W:K=A(C.second_to_time(C.str2sec(W))).strip()+' '+K
  682. Z=D.get(Al,B);a=D.get('like_count',B);b=D.get('follow_count',B)
  683. if Z:K+=By+C.zh(Z)
  684. elif a:K+=' 👍'+A(a)
  685. elif b:K+=' ❤'+A(b)
  686. S.append({Q:V,O:f,U:C.format_img(j),X:K})
  687. F[H]=S;F[h]=pg;F[t]=9999;F[u]=99;F[p]=999999
  688. return F
  689. def get_follow(G,pg,sort):
  690. K=pg;D=sort;L={}
  691. if D==BU:N='https://api.bilibili.com/x/relation/followings?vmid={0}&pn={1}&ps=10&order=desc&order_type=attention'.format(G.userid,K)
  692. elif D==C2:N='https://api.bilibili.com/x/relation/followings?vmid={0}&pn={1}&ps=10&order=desc&order_type='.format(G.userid,K)
  693. elif D==B2:N='https://api.live.bilibili.com/xlive/web-ucenter/v1/xfetter/GetWebList?page={0}&page_size=10'.format(K)
  694. elif D==BV:N='https://api.bilibili.com/x/v2/history?pn={0}&ps=15'.format(K)
  695. elif D==B3:N='https://api.bilibili.com/x/relation/tag?mid={0}&tagid=-10&pn={1}&ps=10'.format(G.userid,K)
  696. elif D==C3:N='https://api.bilibili.com/x/relation/whispers?pn={0}&ps=10'.format(K)
  697. else:N='https://api.bilibili.com/x/relation/followers?vmid={0}&pn={1}&ps=10&order=desc&order_type=attention'.format(G.userid,K)
  698. b=G._get_sth(N);S=I.loads(b.text)
  699. if S[M]!=0:return L
  700. if D==B3 or D==BV:T=S[E]
  701. elif D==B2:T=S[E]['rooms']
  702. else:T=S[E][H]
  703. if F(K)==1:G.recently_up_list=[]
  704. a=[]
  705. for C in T:
  706. V=B
  707. if D==BV:
  708. P=AZ+A(C[AX][W])
  709. if P in G.recently_up_list:continue
  710. G.recently_up_list.append(P);Y=A(C[AX][J]).strip();Z=A(C[AX][A7]).strip()
  711. elif D==B2:P=A(C[Cm]);Y=C[R].replace(k,B).replace(l,B).replace(AJ,AK);Z=C['cover_from_user'].strip();V=C[A8].strip()
  712. else:P=AZ+A(C[W]);Y=A(C[A8]).strip();Z=A(C[A7]).strip()
  713. if C4 in C and C[C4]==1:V=B3
  714. a.append({Q:P,O:Y,U:G.format_img(Z),X:V})
  715. L[H]=a;L[h]=K;L[t]=9999;L[u]=99;L[p]=999999;return L
  716. homeVideoContent_result={}
  717. def homeVideoContent(A):
  718. if not A.homeVideoContent_result:B=A.get_found(rid=L,tid=BW,pg=1)[H][0:F(A.userConfig[Bl])];A.homeVideoContent_result[H]=B
  719. return A.homeVideoContent_result
  720. def categoryContent(H,tid,pg,filter,extend):
  721. J=pg;E=tid;D=extend;H.stop_heartbeat_event.set()
  722. if E==AG:
  723. if A2 in D:E=D[A2]
  724. if E.isdigit():
  725. E=F(E)
  726. if E>10000:E-=10000;return H.get_timeline(tid=E,pg=J)
  727. R=E;E=BW;return H.get_found(tid=E,rid=R,pg=J)
  728. R=L;return H.get_found(tid=E,rid=R,pg=J)
  729. elif E==Ad:
  730. E=T;I=y;U='-1'
  731. if A2 in D:E=D[A2]
  732. if b in D:I=D[b]
  733. if C5 in D:
  734. if I==y:I=A1
  735. U=D[C5]
  736. return H.get_bangumi(E,J,I,U)
  737. elif E==AI:
  738. M=L;I=Ai
  739. if W in D:M=D[W]
  740. if b in D:I=D[b]
  741. if M==L and not H.userid or M=='登录':return H.get_Login_qrcode(J)
  742. return H.get_dynamic(pg=J,mid=M,order=I)
  743. elif E==Ae:
  744. I='hot';P=random.choice(H.userConfig[Aw]);P=P[C]
  745. if b in D:I=D[b]
  746. if n in D:P=D[n]
  747. return H.get_channel(pg=J,cid=P,order=I)
  748. elif E==AH:
  749. E=y;X=L
  750. if A2 in D:E=D[A2]
  751. if K in E:a=E.split(K);E=a[0];X=a[1]
  752. return H.get_live(pg=J,parent_area_id=E,area_id=X)
  753. elif E==A6:
  754. M=H.detailContent_args.get(W,B)
  755. if W in D:M=D[W]
  756. if not M or M=='登录':return H.get_Login_qrcode(J)
  757. c=H.config[Z].get(A6)
  758. if not M and c:
  759. for N in c:
  760. if N[S]==W:
  761. if V(N[G])>1:M=N[G][1][C]
  762. break
  763. I=Ai
  764. if b in D:I=D[b]
  765. return H.get_up_videos(mid=M,pg=J,order=I)
  766. elif E==BF:
  767. e=BU
  768. if C6 in D:e=D[C6]
  769. return H.get_follow(J,e)
  770. elif E==Af:
  771. O=A(H.userConfig[Bm])
  772. if Ag in D:O=D[Ag]
  773. f=H.config[Z].get(Af)
  774. if O in[T,A1]:return H.get_bangumi(tid=O,pg=J,order='追番剧',season_status=B)
  775. elif O==L and f:
  776. for N in f:
  777. if N[S]==Ag:
  778. if V(N[G])>1:O=N[G][2][C]
  779. break
  780. I='mtime'
  781. if b in D:I=D[b]
  782. return H.get_fav_detail(pg=J,mlid=O,order=I)
  783. elif E==BG:
  784. type=BW
  785. if r in D:type=D[r]
  786. if type==BM:return H.get_follow(pg=J,sort=BV)
  787. return H.get_history(type=type,pg=J)
  788. else:
  789. g=L
  790. if d in D:g=D[d]
  791. type=AB
  792. if r in D:type=D[r]
  793. I=Cn
  794. if b in D:I=D[b]
  795. Q=A(H.search_key);h=H.config[Z].get(BH)
  796. if not Q and h:
  797. for N in h:
  798. if N[S]==Ax:
  799. if V(N[G])>0:Q=N[G][0][C]
  800. break
  801. if Ax in D:Q=D[Ax]
  802. return H.get_search_content(key=Q,pg=J,duration_diff=g,order=I,type=type,ps=H.userConfig[Y])
  803. def get_search_content(D,key,pg,duration_diff,order,type,ps):
  804. K=pg;S=AU
  805. if not K.isdigit():S=K;K=1
  806. b=D.encrypt_wbi(keyword=key,page=K,duration=duration_diff,order=order,search_type=type,page_size=ps);c=f"https://api.bilibili.com/x/web-interface/wbi/search/type?{b}";e=D._get_sth(c,P);f=e.text;V=I.loads(f);F={}
  807. if V.get(M)==0 and AM in V[E]:
  808. Y=[];L=V[E].get(AM)
  809. if L and type==AW:L=L.get('live_room')
  810. if not L:return F
  811. for C in L:
  812. J=B
  813. if type==C7:G=AZ+A(C[W]).strip();T=C['upic'].strip();N='👥'+D.zh(C[Ak])+' 🎬'+D.zh(C[Ch]);J=C[A8]
  814. elif type==AW:G=A(C[Cc]).strip();T=C[i].strip();N='👁'+D.zh(C['online'])+Ah+C[A8]
  815. elif'media'in type:
  816. G=A(C[AY]).strip()
  817. if D.detailContent_args:
  818. g=D.detailContent_args.get(B4)
  819. if g:
  820. Z=[]
  821. for j in D.detailContent_args[B4]:Z.append(j[Q])
  822. if G+q in Z:continue
  823. G=q+G;T=C[i].strip();N=A(C[A_]).strip().replace('更新至','🆕')
  824. else:
  825. G=v+A(C[a]).strip();T=C[Ay].strip();N=A(D.second_to_time(D.str2sec(C[d]))).strip()+BP+D.zh(C[Bx])
  826. if S==AU:N+=By+D.zh(C[Al])
  827. if not J:J=C[R].replace(k,B).replace(l,B).replace(AJ,AK).replace('&amp;','&')
  828. if S:J=S+J
  829. Y.append({Q:G,O:J,U:D.format_img(T),X:N})
  830. F[H]=Y;F[h]=K;F[t]=9999;F[u]=99;F[p]=999999
  831. return F
  832. def cleanSpace(A,str):return str.replace('\n',B).replace('\t',B).replace('\r',B).replace(AL,B)
  833. def get_normal_episodes(C,episode):
  834. G=episode;L=H=B;M=G.get(a,B)
  835. if not M:M=C.detailContent_args[a]
  836. U=G.get(n,B);J=G.get(R,B)
  837. if not J:J=G.get(Bz,B)
  838. E=G.get(d,B)
  839. if not E:
  840. V=G.get(h,B)
  841. if V:E=V[d]
  842. D=I=W=Q=B;L=C.detailContent_args.get(B5,B)
  843. if L:
  844. L='_ss'+L;H=G.get(m,B)
  845. if H:H='_ep'+A(H)
  846. if E and A(E).endswith(C8):E=F(E/1000)
  847. if J.isdigit():J='第'+J+C.detailContent_args[C9]
  848. D=G.get('badge',B)
  849. if not C.session_vip.cookies and D=='会员'and C.userConfig[CT]or D=='付费'and C.userConfig[CU]:Q='_parse'
  850. if C.session_vip.cookies and C.userConfig[CR]:D=D.replace('会员',B)
  851. if C.userConfig[CQ]and D=='预告':D=D.replace('预告',B);W=1
  852. if D:D='【'+D+'】'
  853. I=G.get('long_title',B)
  854. if not D and I:I=AL+I
  855. S=J+D+I;S=S.replace(N,AC).replace(w,AD)
  856. if E:E='_dur'+A(E)
  857. O='{0}${1}_{2}{3}{4}{5}'.format(S,M,U,L,H,E);P=C.detailContent_args.get(B6,B)
  858. if K+A(P)==H:C.detailContent_args[B6]=O
  859. X=C.detailContent_args.get(Am)
  860. if K+A(P)==H or not P and X==AU:
  861. C.detailContent_args[Am]=B
  862. if C.userConfig[As]:C.get_vod_hot_reply_event.clear();C.pool.submit(C.get_vod_hot_reply,M)
  863. if L:
  864. if W:return O,B
  865. if Q:
  866. C.detailContent_args[An]=1
  867. if I:I='【解析】'+I
  868. J+=I;T='{0}${1}_{2}{3}{4}{5}{6}'.format(J,M,U,L,H,E,Q)
  869. if K+A(P)==H:C.detailContent_args[B6]+=N+T
  870. else:T=O
  871. return O,T
  872. else:return O
  873. def get_ugc_season(B,section,sections_len):
  874. C=section
  875. if sections_len>1:A=B.detailContent_args[Ao]+AL+C[R]
  876. else:A=B.detailContent_args[Ao]
  877. A=A.replace(N,AC).replace(w,AD);D=C.get(BR);E=N.join(f(B.get_normal_episodes,D));F=A,E;return F
  878. get_vod_hot_reply_event=j.Event()
  879. def get_vod_hot_reply(G,oid):
  880. b='member';c='http://api.bilibili.com/x/v2/reply/main?type=1&ps=30&oid='+A(oid);d=G._get_sth(c,P);L=I.loads(d.text)
  881. if L[M]==0:
  882. H=L[E].get('replies');Y=L[E].get('top_replies')
  883. if H and Y:H=Y+H
  884. if H:
  885. e=L[E]['upper'][W];T=[];U=[]
  886. for D in H:
  887. f=D['rpid'];J=D[b]['sex']
  888. if J and J=='女':J='👧'
  889. else:J='👦'
  890. V=J+D[b][A8]+':';g=D[W]
  891. if g==e:V='🆙'+V
  892. h='👍'+G.zh(D[B1]);Z=D[BO][Co]
  893. if'/note-app/'in Z:continue
  894. F=h+AL+V+Z;F=F.replace(N,AC).replace(w,AD);F+=w+A(oid)+K+A(f)+'_notplay_reply';T.append(F);i=D[BO].get('jump_url',{})
  895. for(C,X)in i.items():
  896. if not X.get('app_url_schema')and not X.get('pc_url'):
  897. if C.startswith('https://www.bilibili.com/'):
  898. C=A(C).split('?')[0].split(AA)
  899. while C[-1]==B:C.pop(-1)
  900. C=C[-1]
  901. if C.startswith(Cp)or C.startswith(BX)or C.startswith(A0)or C.startswith(q):
  902. S=A(X[R]).replace(N,AC).replace(w,AD);a={Q:A(C),O:'评论:'+S}
  903. if not a in U:U.append(a)
  904. S='快搜:'+A(C)+AL+S;F=S+BY;T.append(F)
  905. G.detailContent_args[Am]=N.join(T);G.detailContent_args[Cq]=U
  906. G.get_vod_hot_reply_event.set()
  907. detailContent_args={}
  908. def detailContent(G,array):
  909. c=array;G.stop_heartbeat_event.set();L=c[0]
  910. if L.startswith(BZ):return G.interaction_detailContent(L)
  911. G.detailContent_args={}
  912. if L.startswith(Cp):
  913. try:
  914. A8=CM(url=L,headers=G.header,allow_redirects=False);f=A8.headers['Location'].split('?')[0].split(AA)
  915. while f[-1]==B:f.pop(-1)
  916. L=f[-1]
  917. if not L.startswith(BX,0,2):return{}
  918. except:return{}
  919. id=t=j=B;G.get_vod_hot_reply_event.set()
  920. if L.startswith(Cr):
  921. L=L.split(K)
  922. if L[1]=='tab&filter':return G.setting_tab_filter_detailContent()
  923. elif L[1]=='liveExtra':return G.setting_liveExtra_detailContent()
  924. elif L[1]=='login':A9=L[2];return G.setting_login_detailContent(A9)
  925. elif L.startswith(v)or L.startswith(BX):
  926. for T in L.split(K):
  927. if T.startswith(v):id=T.replace(v,B,1);j='aid='+A(id)
  928. elif T.startswith(BX):id=T;j='bvid='+id
  929. elif T.startswith(Ag):t=T.replace(Ag,B,1)
  930. if G.userConfig[As]:G.detailContent_args[Am]=B;G.get_vod_hot_reply_event.clear();G.pool.submit(G.get_vod_hot_reply,id)
  931. elif AZ in L:return G.up_detailContent(c)
  932. elif q in L or A0 in L:return G.ysContent(c)
  933. elif L.isdigit():return G.live_detailContent(c)
  934. AB=G.pool.submit(G.get_vod_relation,j);f='https://api.bilibili.com/x/web-interface/view/detail?'+j;AE=G._get_sth(f,P);m=I.loads(AE.text)
  935. if m[M]!=0:return{}
  936. S=m[E]['View'];z=S.get(Ba,B)
  937. if C1 in z:
  938. AF=G.find_bangumi_id(z);u=[]
  939. for T in c:u.append(T)
  940. u[0]=AF;return G.ysContent(u)
  941. G.detailContent_args[W]=A1=A(S[AX][W]);G.detailContent_args[a]=L=S.get(a);G.pool.submit(G.get_up_info,mid=A1,data=m[E].get('Card'));n=S.get('ugc_season')
  942. if n:
  943. G.detailContent_args[Ao]=n[R];A2=n['sections'];AG=V(A2);A3=[]
  944. for AH in A2:o=G.pool.submit(G.get_ugc_season,AH,AG);A3.append(o)
  945. A4=m[E].get('Related');A5=S['pages'];AI=S[R].replace(k,B).replace(l,B);AJ=S[Ay];AK=S[AX][J];AL=S[Aa].strip();AM=S['tname'];AP=x.strftime('%Y%m%d',x.localtime(S[Ai]));g=S[BQ];Z=[];Z.append('▶'+G.zh(g[Az]));Z.append('💬'+G.zh(g[Al]));Z.append('👍'+G.zh(g[B1]));h=S.get('honor_reply')
  946. if h:Z.insert(0,'🏅'+h['honor'][0][Aa])
  947. if not h or h and h['honor'][0][r]==4:Z.append('💰'+G.zh(g[C0]));Z.append('⭐'+G.zh(g[Ck]))
  948. AQ=A(S[d]).strip();An=S[d];A6=S['rights'].get('is_stein_gate',0);i={Q:v+A(L),O:AI,U:AJ,BI:AM,CA:AP,CB:Cs,X:AQ,Bb:Ab.join(Z),Ac:AL};y=[]
  949. if G.userid:
  950. AR=Ct;AS=Cu;AT='👍点赞$1_notplay_like';AU='👍🏻取消点赞$2_notplay_like';AV='👍💰投币$1_notplay_coin';AW='👍💰💰投2币$2_notplay_coin';AY='👍💰⭐三连$notplay_triple';p=[AR,AY,AT,AV,AW,AS,AU]
  951. if t:Ad=f"☆取消收藏${t}_del_notplay_fav";p.append(Ad)
  952. for s in G.userConfig.get(CW,[]):Ae=s[D].replace(N,AC).replace(w,AD);Af=s[C];s='⭐{}${}_add_notplay_fav'.format(Ae,Af);p.append(s)
  953. Ah=F(G.userConfig[Aq])
  954. if Ah>116:p.append('⚠️限高1080$116_notplay_vodTMPQn')
  955. y=[N.join(p)]
  956. Y=[];b=[]
  957. if A5:
  958. Y=['B站']
  959. if A6:Y=['互动视频【快搜继续】']
  960. b=[N.join(G.pool.map(G.get_normal_episodes,A5))]
  961. if y:Y.append('做点什么');b.extend(y)
  962. if A4:Y.append('相关推荐');b.append(N.join(G.pool.map(G.get_normal_episodes,A4)))
  963. if G.userConfig[As]:
  964. G.get_vod_hot_reply_event.wait();A7=G.detailContent_args.get(Am,B)
  965. if A7:Y.append('热门评论');b.extend([A7])
  966. if n:
  967. for o in Bi(A3):Y.append(o.result()[0]);b.append(o.result()[1])
  968. i[AN]=e.join(Y);i[AO]=e.join(b);i[CC]='🆙 '+AK+Cv+G.up_info[A1][Ak]+Ab+Ab.join(AB.result())
  969. if A6:G.detailContent_args['AllPt']=Y.copy();G.detailContent_args['AllPu']=b.copy();G.detailContent_args[Cw]=i.copy()
  970. Aj={H:[i]};return Aj
  971. def interaction_detailContent(C,array=B):
  972. F=array;F=F.split(K);V=G=0
  973. for D in F:
  974. if D.startswith(BZ):G=D.replace(BZ,B)
  975. elif D.startswith(n):V=D.replace(n,B)
  976. W=C.detailContent_args.get(a);c=C.detailContent_args.get(B7);J='https://api.bilibili.com/x/stein/edgeinfo_v2?aid={0}&graph_version={1}&edge_id={2}'.format(W,c,G);d=C._get_sth(J,P);f=I.loads(d.text);L=f.get(E);X={}
  977. if L:
  978. g=L['edges'].get('questions',[]);M=[]
  979. for Y in g:
  980. S=A(Y.get(R,B))
  981. if S:S+=AL
  982. for T in Y.get('choices',[]):h=A(T[m]);i=A(T[n]);j=A(T.get('option',B));M.append({Q:BZ+h+K+n+i,O:'互动:'+S+j})
  983. C.detailContent_args[CD]=M.copy()
  984. if G:
  985. Z=C.detailContent_args['AllPt'].copy()
  986. if not M:Z[0]='互动视频'
  987. b=C.detailContent_args['AllPu'].copy();k=A(L[R]).replace(N,AC).replace(w,AD);J='{0}${1}_{2}'.format(k,W,V);b[0]=J;U=C.detailContent_args[Cw].copy();U[AN]=e.join(Z);U[AO]=e.join(b);X[H]=[U]
  988. return X
  989. def up_detailContent(D,array):D.detailContent_args[W]=E=array[0].replace(AZ,B);D.get_up_info_event.clear();D.pool.submit(D.get_up_info,E);I=Cx;K='关注$1_notplay_follow';L='取消关注$2_notplay_follow';M='悄悄关注$3_notplay_follow';P='特别关注$-10_notplay_special_follow';R='取消特别关注$0_notplay_special_follow';F=[I,K,M,P,L,R];F=N.join(F);D.get_up_info_event.wait();C=D.up_info[E];G={Q:AZ+A(E),O:C[J]+Cg,U:C[A7],X:B,'vod_tags':'mv',Bb:'👥 '+C[Ak]+'\u3000🎬 '+C[BS]+'\u3000👍 '+C[B_],CC:'🆙 '+C[J]+Ab+C[Aj]+Cy+A(E),Ac:C[Aa],AN:'关注TA$$$视频投稿在动态标签——筛选——上个UP,选择后查看'};G[AO]=F;S={H:[G]};return S
  990. def setting_login_detailContent(E,key):
  991. b='检查失败';M=key;G='f';D='d';C='c';c=E.cookie_dic_tmp.get(M,B);J=B
  992. if not c:J=E.get_cookies(M)
  993. if J:J=f"【{J}】通过手机客户端扫码确认登录后点击相应按钮设置账号"
  994. else:J='【已扫码并确认登录】请点击相应按钮设置当前获取的账号为:'
  995. R={O:'登录与设置',Ac:'通过手机客户端扫码并确认登录后,点击相应按钮设置cookie,设置后不需要管嗅探结果,直接返回二维码页面刷新,查看是否显示已登录,已登录即可重新打开APP以加载全部标签'};X=['登录$$$退出登录'];P=[];d=J+BY;f='设置为主账号,动态收藏关注等内容源于此$'+A(M)+'_master_login_setting';g='设置为备用的VIP账号,仅用于播放会员番剧$'+A(M)+'_vip_login_setting';P.append(N.join([d,f,g]));h='点击相应按钮退出账号>>>$ ';i='退出主账号$master_logout_setting';j='退出备用的VIP账号$vip_logout_setting';P.append(N.join([h,i,j]));Y=[{G:'主页站点推荐栏',C:Bl,D:{AR:'3图',AV:'4图','6':'6图','8':'8图','10':'10图'}},{G:'视频画质',C:Aq,D:E.vod_qn_id},{G:'视频编码',C:Bn,D:E.vod_codec_id},{G:'音频码率',C:Ar,D:E.vod_audio_id},{G:'收藏默认显示',C:Bm,D:{L:'默认收藏夹',T:'追番',A1:'追剧'}},{G:'上传播放进度',C:BC,D:{L:'关','15':'开'}},{G:'直播筛选细化',C:Bo,D:{L:'关',T:'开'}}];S={G:'检查更新',C:CE};U=E.userConfig.get(AP,b);V=Z=0
  996. if U!=b:U='远端:'+A(E.userConfig[AP][CF]);Z=1;V=E.userConfig[AP].get(Bc)
  997. S[D]={A(Z):U}
  998. if V:S[D][AL]=V
  999. Y.insert(0,S)
  1000. for I in Y:
  1001. X.append(I[G])
  1002. if I[C]==CE:Q=E.userConfig[Bk]
  1003. else:Q=I[D][A(F(E.userConfig[I[C]]))]
  1004. if Ar==I[C]:Q=A(Q).replace(C8,'k')
  1005. a=['当前:'+Q+BY]
  1006. for(id,W)in I[D].items():
  1007. if Ar==I[C]:W=A(W).replace(C8,'k')
  1008. a.append(W+w+A(id)+K+I[C]+'_setting')
  1009. P.append(N.join(a))
  1010. R[AN]=e.join(X);R[AO]=e.join(P);k={H:[R]};return k
  1011. def setting_tab_filter_detailContent(I):
  1012. L={O:'标签与筛选',Ac:'依次点击各标签,同一标签第一次点击为添加,第二次删除,可以返回到二维码页后重进本页查看预览,最后点击保存,未选择的将追加到末尾,如果未保存就重启app,将丢失未保存的配置'};M=[];P=[];U=[{D:At,C:'标签'},{D:BD,C:'推荐[分区]'},{D:BE,C:'推荐[排行榜]'},{D:z,C:AH}]
  1013. for Q in U:
  1014. E=Q[D];M.append(Q[C]);F=I.userConfig.get(A(E)+AE,[]);R=B
  1015. if F:R='【未保存】'
  1016. else:F=I.userConfig.get(E,[])
  1017. if not F:F=I.defaultConfig.get(E)
  1018. if F and type(F[0])==A3:F=s(f(lambda x:x[D],F))
  1019. S=['当前: '+','.join(F)+BY,f"{R}点击这里保存$_{E}_save_setting",f"点击这里恢复默认并保存$_{E}_clear_setting"];J=I.defaultConfig[E].copy()
  1020. if E==At and not A6 in J:J.append(A6)
  1021. elif E==z:V=I.userConfig.get(A5,[]);J.extend(V.copy())
  1022. for G in J:
  1023. T=A(G)
  1024. if type(G)==A3:T=G[D]+Ap+G[C].replace(K,Ap);G=G[D]
  1025. S.append(f"{G}${T}_{E}_setting")
  1026. P.append(N.join(S))
  1027. L[AN]=e.join(M);L[AO]=e.join(P);W={H:[L]};return W
  1028. def setting_liveExtra_detailContent(I):
  1029. Q='_liveFilter_setting';F={O:CX,Ac:'点击想要添加的标签,同一标签第一次点击为添加,第二次删除,完成后在[标签与筛选]页继续操作,以添加到直播筛选分区列中'};J=['已添加'];R=I.userConfig.get(A5,[]);E=['点击相应标签(只)可以删除$ #清空$clear_liveFilter_setting']
  1030. for B in R:S=B[C];B=B[D];E.append(B+w+'del_'+B+K+S+Q)
  1031. E=[N.join(E)];T=I.userConfig.get(AT,{})
  1032. for(U,W)in T.items():
  1033. L=W[G][G]
  1034. if V(L)==1:continue
  1035. J.append(U);M=[]
  1036. for P in L:B=A(P[D]).replace(K,'-').replace(N,AC).replace(w,AD);id=A(P[C]).replace(K,Ap).replace(N,AC).replace(w,AD);M.append(B+'$add_'+B+K+id+Q)
  1037. E.append(N.join(M))
  1038. F[AN]=e.join(J);F[AO]=e.join(E);X={H:[F]};return X
  1039. def get_all_season(C,season):
  1040. B=season;D=A(B[AY]);E=B[Ao]
  1041. if D==C.detailContent_args[B5]:C.detailContent_args[B8]=E
  1042. F=B[i];G=B[B0][A_];H={Q:D+q,O:'系列:'+E,U:C.format_img(F),X:G};return H
  1043. def get_bangumi_section(B,section):
  1044. A=section;C=A[R].replace(N,AC).replace(w,AD);D=A[r]
  1045. if D in[1,2]and V(A['episode_ids'])==0:E=A[BR];F=N.join(f(lambda x:B.get_normal_episodes(x)[0],E));return C,F
  1046. def ysContent(C,array):
  1047. p='rating';E=array[0]
  1048. if A0 in E:C.detailContent_args[B6]=E;E='ep_id='+E.replace(A0,B)
  1049. elif q in E:E='season_id='+E.replace(q,B)
  1050. t='https://api.bilibili.com/pgc/view/web/season?{0}'.format(E);u=C._get_sth(t,P);v=I.loads(u.text);D=v[AM];C.detailContent_args[B5]=A(D[AY]);w=D[R];C.detailContent_args[B8]=D[Ao];C.detailContent_args[C9]='集'
  1051. if D[r]in[1,4]:C.detailContent_args[C9]='话'
  1052. M=D.get(B4)
  1053. if V(M)==1:C.detailContent_args[B8]=M[0][Ao];M=0
  1054. else:C.detailContent_args[B4]=s(C.pool.map(C.get_all_season,M))
  1055. f=D.get(BR);g=[]
  1056. for J in D.get('section',[]):
  1057. if J:b=C.pool.submit(C.get_bangumi_section,J);g.append(b)
  1058. x=D[i];y=D['share_sub_title'];z=D['publish']['pub_time'][0:4];A1=D['evaluate'];A2=D[B0][Aa];S=D[BQ];c='▶'+C.zh(S['views'])+Ci+C.zh(S['danmakus'])+'\u3000👍'+C.zh(S['likes'])+'\u3000💰'+C.zh(S['coins'])+'\u3000❤'+C.zh(S['favorites'])
  1059. if p in D:c=A(D[p]['score'])+'分\u3000'+c
  1060. d={Q:q+C.detailContent_args[B5],O:w,U:x,BI:y,CA:z,CB:Cs,X:A2,Bb:c,Ac:A1};a=[];G=[]
  1061. if C.userid:
  1062. a=['做点什么'];G='是否追番剧$ #❤追番剧$add_notplay_zhui#💔取消追番剧$del_notplay_zhui';A3=F(C.userConfig[Aq])
  1063. if A3>116:G+='#⚠️限高1080$116_notplay_vodTMPQn'
  1064. G=[G]
  1065. if M:a.append('更多系列');G.append('更多系列在快速搜索中查看$ #')
  1066. h=[];T=[];j=[];W=[];k=[];L=[]
  1067. if f:
  1068. for(l,m)in C.pool.map(C.get_normal_episodes,f):
  1069. if m:T.append(l);L.append(m)
  1070. else:W.append(l)
  1071. if T:h=[C.detailContent_args[B8]];T=[N.join(T)]
  1072. if W:j=['预告'];W=[N.join(W)]
  1073. if not C.detailContent_args.get(An):L=[]
  1074. if L:k=[A(C.detailContent_args[B8])+'【解析】'];L=[N.join(L)]
  1075. Y=k+h+j;Z=L+T+W
  1076. for b in Bi(g):
  1077. J=b.result()
  1078. if J:Y.append(J[0]);Z.append(J[1])
  1079. n=C.detailContent_args.get(B6,B)
  1080. if K in n:Y=['B站']+Y;Z=[n]+Z
  1081. if C.userConfig[As]:
  1082. C.get_vod_hot_reply_event.wait();o=C.detailContent_args.get(Am,B)
  1083. if o:a.append('热门评论');G.append(o)
  1084. Y.insert(1,e.join(a));Z.insert(1,e.join(G));d[AN]=e.join(Y);d[AO]=e.join(Z);A4={H:[d]};return A4
  1085. def get_live_api2_playurl(O,room_id):
  1086. Q=room_id;D='qn';R=[];S=[];H='https://api.live.bilibili.com/xlive/web-room/v2/index/getRoomPlayInfo?room_id={0}&no_playurl=0&mask=1&qn=0&platform=web&protocol=0,1&format=0,1,2&codec=0,1&dolby=5&panorama=1'.format(Q);Z=O._get_sth(H,P);U=I.loads(Z.text)
  1087. if U[M]==0:
  1088. J=U[E].get(Cz,B)
  1089. if J:
  1090. a=J[CG][C_];C={Bd:{'avc':L,'hevc':T},Be:{'flv':L,'ts':T,'fmp4':A1}};C[D]=A3(O.pool.map(lambda x:(x[D],x[Aa]),J[CG]['g_qn_desc']));V=[]
  1091. for b in a:V.extend(b[Be])
  1092. F={}
  1093. for W in V:
  1094. format=A(W.get('format_name'))
  1095. for X in W[Bd]:
  1096. Y=A(X.get('codec_name'));c=X.get('accept_qn')
  1097. for G in c:
  1098. H=format+K+Y+'$liveapi2_'+A(G)+K+C[Be][format]+K+C[Bd][Y]+K+A(Q)
  1099. if not F.get(C[D][G]):F[C[D][G]]=[]
  1100. F[C[D][G]].append(H)
  1101. for(d,e)in F.items():R.append(d);S.append(N.join(e))
  1102. f={'From':R,o:S};return f
  1103. def live_detailContent(C,array):
  1104. F=array[0];X=C.pool.submit(C.get_live_api2_playurl,F);c='https://api.live.bilibili.com/room/v1/Room/get_info?room_id='+A(F);d=C._get_sth(c,P);Y=I.loads(d.text);Z={}
  1105. if Y.get(M)==0:
  1106. D=Y[E];C.detailContent_args[W]=S=A(D['uid']);C.get_up_info_event.clear();C.pool.submit(C.get_up_info,S);f=D[R].replace(k,B).replace(l,B);g=D.get(Cd);h=D.get('description');i=D.get('parent_area_name')+'--'+D.get('area_name');G=D.get(CZ,B)
  1107. if G:G='开播时间:'+D.get('live_time').replace('-','.')
  1108. else:G='未开播'
  1109. K={Q:F,O:f,U:g,BI:i,CA:B,CB:'bililivedanmu',Bb:'房间号:'+F+Cy+S+Ab+G,Ac:h};T=B;a=B
  1110. if C.userid:T='关注Ta';j=Cx;m=Ct;n=Cu;p=[j,m,n];a=N.join(p)
  1111. L=X.result().get('From',[]);V=X.result().get(o,[])
  1112. if L:q='API_1';r='flv线路原画$platform=web&quality=4_'+F+'#flv线路高清$platform=web&quality=3_'+F+'#h5线路原画$platform=h5&quality=4_'+F+'#h5线路高清$platform=h5&quality=3_'+F;L.append(q);V.append(r)
  1113. if T:L.insert(1,T);V.insert(1,a)
  1114. K[AN]=e.join(L);K[AO]=e.join(V);C.get_up_info_event.wait();b=C.up_info[S];K[CC]='🆙 '+b[J]+Cv+C.zh(D.get(Cj))+Ab+b[Aj];Z[H]=[K]
  1115. return Z
  1116. search_key=B
  1117. def searchContent(A,key,quick):
  1118. F=quick
  1119. if not A.session_fake.cookies:A.pool.submit(A.getFakeCookie,AF)
  1120. for C in A.task_pool:C.cancel()
  1121. A.task_pool=[];A.search_key=key;E=A.detailContent_args.get(W,B)
  1122. if F and E:G=A.pool.submit(A.get_up_videos,E,1,Cf)
  1123. I={AB:B,D0:'番剧: ',D1:'影视: ',C7:'用户: ',AW:'直播: '}
  1124. for(type,J)in I.items():C=A.pool.submit(A.get_search_content,key=key,pg=J,duration_diff=0,order=B,type=type,ps=A.userConfig[Y]);A.task_pool.append(C)
  1125. D={H:[]}
  1126. for C in Bi(A.task_pool):K=C.result().get(H,[]);D[H].extend(K);A.task_pool.remove(C)
  1127. if F:
  1128. if E:D[H]=A.detailContent_args.get(CD,[])+G.result().get(H,[])+A.detailContent_args.get(Cq,[])+D[H]
  1129. else:D[H]=A.detailContent_args.get(B4,[])+D[H]
  1130. return D
  1131. stop_heartbeat_event=j.Event()
  1132. def start_heartbeat(C,aid,cid,ids):
  1133. N=aid;L=cid;M=O=S=B
  1134. for G in ids:
  1135. if q in G:O=G.replace(q,B)
  1136. elif A0 in G:S=G.replace(A0,B)
  1137. elif CH in G:M=F(G.replace(CH,B))
  1138. H='https://api.bilibili.com/x/player/v2?aid={0}&cid={1}'.format(N,L);Q=C._get_sth(H);X=I.loads(Q.text);D=X.get(E,{});T=D.get(CD,{})
  1139. if T.get(B7):
  1140. U=T.get(B7);Y=C.detailContent_args.get(B7)
  1141. if Y!=U:C.detailContent_args[B7]=U;C.pool.submit(C.interaction_detailContent)
  1142. R=F(C.userConfig[BC])
  1143. if not C.userid or not R:return
  1144. if not M:H='https://api.bilibili.com/x/web-interface/view?aid={0}&cid={1}'.format(N,L);Q=C._get_sth(H,P);Z=I.loads(Q.text);M=Z[E][d]
  1145. J=0
  1146. if F(D.get('last_play_cid',0))==F(L):
  1147. V=F(D.get('last_play_time'))
  1148. if V>0:J=F(V/1000)
  1149. W=F((M-J)/R)+1;H='https://api.bilibili.com/x/click-interface/web/heartbeat';D={a:A(N),n:A(L),CI:A(C.csrf)}
  1150. if O:D['sid']=A(O);D['epid']=A(S);D[r]=AV
  1151. K=0;C.stop_heartbeat_event.clear()
  1152. while AF:
  1153. if K==R or C.stop_heartbeat_event.is_set():J+=K;K=0
  1154. if not K:
  1155. W-=1
  1156. if not W:J=-1;C.stop_heartbeat_event.set()
  1157. D['played_time']=A(J);C.pool.submit(C._post_sth,url=H,data=D)
  1158. if C.stop_heartbeat_event.is_set():break
  1159. x.sleep(1);K+=1
  1160. wbi_key={}
  1161. def get_wbiKey(A,wts):D='wbi_img';C=A.fetch(CV,headers=A.header);F=C.json()[E][D]['img_url'];G=C.json()[E][D]['sub_url'];H=[46,47,18,2,53,8,23,32,15,50,10,31,58,3,45,35,27,43,5,49,33,9,42,19,29,28,14,39,12,38,41,13,37,48,7,16,24,55,40,61,26,17,0,1,60,51,30,4,22,25,54,21,56,59,6,63,57,62,11,36,20,34,44,52];I=F.split(AA)[-1].split('.')[0]+G.split(AA)[-1].split('.')[0];J=reduce(lambda s,i:s+I[i],H,B);A.wbi_key={S:J[:32],CJ:wts}
  1162. def encrypt_wbi(D,**C):
  1163. E=Bj(x.time())
  1164. if not D.wbi_key or abs(D.wbi_key[CJ])<30:D.get_wbiKey(E)
  1165. C[CJ]=E;C=A3(sorted(C.items()));C={C:B.join(filter(lambda chr:chr not in"!'()*",A(D)))for(C,D)in C.items()};F=CN(C);return F+'&w_rid='+hashlib.md5((F+D.wbi_key[S]).encode(encoding=Au)).hexdigest()
  1166. def _get_sth(A,url,_type=g):
  1167. D=_type;B=url
  1168. if D==AS and A.session_vip.cookies:C=A.session_vip.get(B,headers=A.header)
  1169. elif D==P:
  1170. if not A.session_fake.cookies:A.getFakeCookie_event.wait()
  1171. C=A.session_fake.get(B,headers=A.header)
  1172. else:C=A.session_master.get(B,headers=A.header)
  1173. return C
  1174. def _post_sth(A,url,data):return A.session_master.post(url,headers=A.header,data=data)
  1175. def post_live_history(B,room_id):C={Cm:A(room_id),'platform':'pc',CI:A(B.csrf)};D='https://api.live.bilibili.com/xlive/web-room/v1/index/roomEntryAction';B._post_sth(url=D,data=C)
  1176. def do_notplay(F,ids):
  1177. C=ids;G=F.detailContent_args.get(a);H=F.detailContent_args.get(W);I=F.detailContent_args.get(B5);D={CI:A(F.csrf)};E=B
  1178. if CK in C:F.detailContent_args[CK]=A(C[0]);return
  1179. elif'follow'in C:
  1180. if C4 in C:D.update({'fids':A(H),'tagids':A(C[0])});E='https://api.bilibili.com/x/relation/tags/addUsers'
  1181. else:D.update({'fid':A(H),'act':A(C[0])});E='https://api.bilibili.com/x/relation/modify'
  1182. elif'zhui'in C:D.update({AY:A(I)});E='https://api.bilibili.com/pgc/web/follow/'+A(C[0])
  1183. elif B1 in C:D.update({a:A(G),B1:A(C[0])});E='https://api.bilibili.com/x/web-interface/archive/like'
  1184. elif C0 in C:D.update({a:A(G),'multiply':A(C[0]),'select_like':T});E='https://api.bilibili.com/x/web-interface/coin/add'
  1185. elif'fav'in C:D.update({'rid':A(G),r:A1});D[C[1]+'_media_ids']=A(C[0]);E='https://api.bilibili.com/x/v3/fav/resource/deal'
  1186. elif'triple'in C:D.update({a:A(G)});E='https://api.bilibili.com/x/web-interface/archive/like/triple'
  1187. elif'reply'in C:D.update({'oid':A(C[0]),'rpid':A(C[1]),r:T,'action':T});E='http://api.bilibili.com/x/v2/reply/action'
  1188. F._post_sth(url=E,data=D)
  1189. def get_cid(D,video):
  1190. C=video;F='https://api.bilibili.com/x/web-interface/view?aid=%s'%A(C[a]);G=D._get_sth(F);H=I.loads(G.text);B=H[E];C[n]=B[n];C[d]=B[d]
  1191. if Ba in B and C1 in B[Ba]:C[A0]=D.find_bangumi_id(B[Ba])
  1192. cookie_dic_tmp={}
  1193. def get_cookies(A,key):
  1194. D='https://passport.bilibili.com/x/passport-login/web/qrcode/poll?qrcode_key='+key;F=A._get_sth(D,P);B=I.loads(F.text)
  1195. if B[M]==0:
  1196. C=B[E][Co]
  1197. if not C:A.cookie_dic_tmp[key]=A3(A.session_fake.cookies);A.pool.submit(A.getFakeCookie)
  1198. return C
  1199. return'网络错误'
  1200. def set_cookie(A,key,_type):
  1201. D=_type;C=key;F=A.cookie_dic_tmp.get(C,B)
  1202. if not F:
  1203. G=A.get_cookies(C)
  1204. if G:return
  1205. E=A.userConfig.get(c,{});E[D]={A4:A.cookie_dic_tmp.get(C,{})};A.userConfig.update({c:E});A.getCookie(D);A.dump_config()
  1206. def unset_cookie(A,_type):
  1207. C=_type
  1208. if C==AS:A.session_vip.cookies.clear()
  1209. else:A.session_master.cookies=A.session_fake.cookies;A.userid=A.csrf=B
  1210. if C in A.userConfig.get(c,{}):A.userConfig[c].pop(C);A.dump_config()
  1211. def set_normal_default(B,id,type):B.userConfig[type]=A(id);B.dump_config()
  1212. def set_normal_cateManual(B,name,_List,action):
  1213. H=action;F=name;E=_List;G=B.userConfig.get(A(E)+AE)
  1214. if not G:G=B.userConfig[A(E)+AE]=[]
  1215. if H=='save':
  1216. for I in B.defaultConfig[E]:
  1217. if not I in G.copy():B.userConfig[A(E)+AE].append(I)
  1218. B.userConfig[E]=B.userConfig[A(E)+AE].copy();B.userConfig.pop(E+AE);B.dump_config()
  1219. elif H=='clear':B.userConfig[E]=B.defaultConfig[E].copy();B.userConfig.pop(A(E)+AE);B.dump_config()
  1220. else:
  1221. if E==z:
  1222. F=F.split(Ap)
  1223. if V(F)==3:F[1]+=K+A(F[2])
  1224. F={D:F[0],C:A(F[1])}
  1225. if F in G:B.userConfig[A(E)+AE].remove(F)
  1226. else:B.userConfig[A(E)+AE].append(F)
  1227. def add_cateManualLiveExtra(A,action,name,id):
  1228. F='cateManualLive_tmp';G=A.userConfig.get(A5,[])
  1229. if not G:G=A.userConfig[A5]=[]
  1230. if action=='clear':
  1231. for E in G:
  1232. E[C]=E[C].replace(Ap,K)
  1233. if E in A.userConfig.get(z,[]):A.userConfig[z].remove(E)
  1234. if E in A.userConfig.get(F,[]):A.userConfig[F].remove(E)
  1235. A.userConfig.pop(A5)
  1236. elif id in s(f(lambda x:x[C],A.userConfig.get(A5,[]))):
  1237. B={D:name,C:id};A.userConfig[A5].remove(B);B[C]=id.replace(Ap,K)
  1238. if B in A.userConfig.get(z,[]):A.userConfig[z].remove(B)
  1239. if B in A.userConfig.get(F,[]):A.userConfig[F].remove(B)
  1240. else:B={D:name,C:id};A.userConfig[A5].append(B)
  1241. A.dump_config()
  1242. def _checkUpdate(A,action):
  1243. E={A9:A.header[A9]}
  1244. if F(action):
  1245. D=A.userConfig.get(AP)
  1246. if D and D[CF]!=A.userConfig[Bk]:
  1247. A.userConfig[AP][Bc]='正在更新';B=D[o];C=CM(url=B,headers=E,timeout=(3,5))
  1248. if C.status_code==200:
  1249. H=B.split(AA)
  1250. with BA(f"{AQ}/{H[-1]}",'w',encoding=Au)as J:J.write(C.text)
  1251. A.userConfig[AP][Bc]='更新完成'
  1252. else:A.userConfig[AP][Bc]='更新失败'
  1253. else:
  1254. B='http://jm92swf.s1002.xrea.com/index.php/update.json';C=A.fetch(B,headers=E);G=I.loads(C.text);K=G.get(CF)
  1255. if K:A.userConfig[AP]=G
  1256. vod_qn_id={'127':'8K','126':'杜比视界','125':'HDR','120':'4K','116':'1080P60帧','112':'1080P+','80':'1080P','64':'720P'};vod_codec_id={'7':'avc','12':'hevc','13':'av1'};vod_audio_id={'30280':D2,'30232':'132000','30216':'64000'}
  1257. def get_dash_media(I,video):
  1258. H='SegmentBase';B=video;C=A(B.get(m));D=B.get(D3);J=B.get('codecs');L=B.get('bandwidth');M=B.get('startWithSap');E=B.get(D4);N=B.get('baseUrl').replace('&','&amp;');O=B[H].get('indexRange');P=B[H].get('Initialization');F=E.split(AA)[0]
  1259. if F==AB:Q=B.get('frameRate');R=B.get('sar');S=B.get('width');T=B.get('height');G=f"height='{T}' width='{S}' frameRate='{Q}' sar='{R}'"
  1260. elif F==Bf:U=I.vod_audio_id.get(C,D2);G=f"numChannels='2' sampleRate='{U}'"
  1261. if D:C+=K+A(D)
  1262. V=f'''
  1263. <Representation id="{C}" bandwidth="{L}" codecs="{J}" mimeType="{E}" {G} startWithSAP="{M}">
  1264. <BaseURL>{N}</BaseURL>
  1265. <SegmentBase indexRange="{O}">
  1266. <Initialization range="{P}"/>
  1267. </SegmentBase>
  1268. </Representation>''';return V
  1269. def get_dash_media_list(I,media_lis):
  1270. D=media_lis
  1271. if not D:return B
  1272. E=D[0][D4].split(AA)[0];C=N=B
  1273. if E==AB:
  1274. C=J=I.detailContent_args.get(CK,B)
  1275. if J:J=F(J)
  1276. else:C=A(I.userConfig[Aq]);J=120
  1277. N=A(I.userConfig[Bn])
  1278. elif E==Bf:C=A(I.userConfig[Ar]);J=F(C);N=L
  1279. G=s(f(lambda x:A(x[m])+K+A(x[D3]),D));H=[]
  1280. if C+K+N in G:H.append(D[G.index(C+K+N)])
  1281. if not H and E==AB:
  1282. for Q in I.vod_codec_id.keys():
  1283. if C+K+A(Q)in G:H.append(D[G.index(C+K+A(Q))])
  1284. if not H:
  1285. M=B
  1286. for P in G:
  1287. O=P.split(K)
  1288. if M and F(M)>F(O[0]):break
  1289. elif E==AB and F(O[0])<=J and not M or E==Bf and not M or F(O[0])==M:
  1290. M=F(O[0])
  1291. if E==AB and A(O[1])==N:H=[D[G.index(A(P))]];break
  1292. H.append(D[G.index(A(P))])
  1293. R=f'\n <AdaptationSet>\n <ContentComponent contentType="{E}"/>{B.join(f(I.get_dash_media,H))}\n </AdaptationSet>';return R
  1294. get_dash_event=j.Event()
  1295. def get_dash(A,ja):
  1296. B=ja.get(d);C=ja.get('minBufferTime');D=A.pool.submit(A.get_dash_media_list,ja.get(AB));E=A.pool.submit(A.get_dash_media_list,ja.get(Bf));F=f'<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" type="static" mediaPresentationDuration="PT{B}S" minBufferTime="PT{C}S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">\n <Period duration="PT{B}S" start="PT0S">{D.result()}{E.result()}\n </Period>\n</MPD>'
  1297. with BA(f"{AQ}/playurl.mpd",'w',encoding=Au)as G:G.write(F)
  1298. A.get_dash_event.set();x.sleep(3);os.remove(f"{AQ}/playurl.mpd")
  1299. def get_durl(I,ja):
  1300. H='size';C=-1;A=-1
  1301. for D in range(V(ja)):
  1302. E=ja[D]
  1303. if C<F(E[H]):C=F(E[H]);A=D
  1304. G=B
  1305. if V(ja)>0:
  1306. if A==-1:A=0
  1307. G=ja[A][o]
  1308. return G
  1309. def playerContent(C,flag,id,vipFlags):
  1310. S='https://api.bilibili.com/x/v1/dm/list.so?oid=';C.stop_heartbeat_event.set();D={D5:B,o:B};F=id.split(K)
  1311. if'web'in id or D6==F[0]:return C.live_playerContent(flag,id,vipFlags)
  1312. if V(F)<2:return D
  1313. H=F[0];G=F[1]
  1314. if Cr in F:
  1315. if'liveFilter'in id:id=F[2];C.add_cateManualLiveExtra(H,G,id)
  1316. elif G==CE:C._checkUpdate(H)
  1317. elif G in[At,z,BD,BE]:U=F[2];C.set_normal_cateManual(H,G,U)
  1318. elif'login'in id:C.set_cookie(H,G)
  1319. elif'logout'in id:C.unset_cookie(H)
  1320. else:C.set_normal_default(H,G)
  1321. return D
  1322. elif'notplay'in F:C.pool.submit(C.do_notplay,F);return D
  1323. elif G==n:
  1324. N={a:A(H)};C.get_cid(N);G=N[n];F.append(CH+A(N[d]));P=N.get(A0)
  1325. if P:id+=K+P;F.append(P)
  1326. W=C.encrypt_wbi(avid=H,cid=G,fnval=4048,fnver=0,fourk=1)
  1327. O=f"https://api.bilibili.com/x/player/wbi/playurl?{W}"
  1328. dan = f'https://api.bilibili.com/x/v1/dm/list.so?oid={G}'
  1329. if A0 in id:
  1330. if An in id:X=s(A for A in f(lambda x:x if A0 in x else AU,F)if A is not AU);O='https://www.bilibili.com/bangumi/play/'+X[0];D[o]=O;D['flag']='bilibili';D[An]=T;D['jx']=T;D[CL]=A({A9:C.header[A9]});D[Al]=S+A(G)
  1331. D['danmaku'] = dan
  1332. return D
  1333. O='https://api.bilibili.com/pgc/player/web/playurl?aid={}&cid={}&fnval=4048&fnver=0&fourk=1'.format(H,G)
  1334. Y=C._get_sth(O,AS);J=I.loads(Y.text)
  1335. if J[M]==0:
  1336. if E in J:Q=J[E]
  1337. elif AM in J:Q=J[AM]
  1338. else:
  1339. D['danmaku'] = dan
  1340. return D
  1341. else:
  1342. D['danmaku'] = dan
  1343. return D
  1344. R=Q.get('dash')
  1345. if R:C.get_dash_event.clear();Z=C.pool.submit(C.get_dash,R);C.get_dash_event.wait();D[o]=f"{AQ}/playurl.mpd"
  1346. else:D[o]=C.get_durl(Q.get('durl',{}))
  1347. D[An]=L;D[B9]=B;D[CL]=C.header;D[Al]=S+A(G);C.pool.submit(C.start_heartbeat,H,G,F)
  1348. D['danmaku'] = dan
  1349. return D
  1350. def live_playerContent(G,flag,id,vipFlags):
  1351. U='video/x-flv';T='url_info';C={D5:B,o:B};D=id.split(K)
  1352. dan = f'https://api.bilibili.com/x/v1/dm/list.so?oid={D[1]}'
  1353. if V(D)<2:
  1354. C['danmaku'] = dan
  1355. return C
  1356. if G.userid and F(G.userConfig[BC])>0:G.pool.submit(G.post_live_history,D[-1])
  1357. if D[0]==D6:
  1358. W=F(D[1]);format=F(D[2]);H=F(D[3]);X=F(D[-1]);O='https://api.live.bilibili.com/xlive/web-room/v2/index/getRoomPlayInfo?room_id={0}&protocol=0,1&format={1}&codec={2}&qn={3}&ptype=8&platform=web&dolby=5&panorama=1&no_playurl=0&mask=1'.format(X,format,H,W);Q=G._get_sth(O,P);J=I.loads(Q.text)
  1359. if J[M]==0:
  1360. try:N=J[E][Cz].get(CG);H=N[C_][0][Be][0][Bd][0]
  1361. except:
  1362. C['danmaku'] = dan
  1363. return C
  1364. Y=A(H['base_url']);Z=A(H[T][0]['host']);a=A(H[T][0]['extra']);N=Z+Y+a;C[o]=N
  1365. if'.flv'in N:C[B9]=U
  1366. else:C[B9]=B
  1367. else:
  1368. C['danmaku'] = dan
  1369. return C
  1370. else:
  1371. O='https://api.live.bilibili.com/room/v1/Room/playUrl?cid=%s&%s'%(D[1],D[0])
  1372. try:Q=G._get_sth(O)
  1373. except:
  1374. C['danmaku'] = dan
  1375. return C
  1376. R=I.loads(Q.text)
  1377. if R[M]==0:
  1378. J=R[E];S=J['durl']
  1379. if V(S)>0:C[o]=S[0][o]
  1380. if'h5'in D[0]:C[B9]=B
  1381. else:C[B9]=U
  1382. else:
  1383. C['danmaku'] = dan
  1384. return C
  1385. C[An]=L;C[CL]={D7:'https://live.bilibili.com',A9:G.header[A9]}
  1386. C['danmaku'] = dan
  1387. return C
  1388. config={'player':{},Z:{BF:[{S:C6,J:'分类',G:[{D:B2,C:B2},{D:BU,C:BU},{D:C2,C:C2},{D:B3,C:B3},{D:C3,C:C3},{D:'我的粉丝',C:'我的粉丝'}]}],AI:[{S:b,J:'别人投稿排序',G:[{D:'最新发布',C:Ai},{D:'最多播放',C:'click'},{D:'最多收藏',C:'stow'},{D:'最早发布',C:Ce}]}],Ad:[{S:A2,J:'分类',G:[{D:'番剧',C:T},{D:'国创',C:AV},{D:'电影',C:A1},{D:'电视剧',C:'5'},{D:'纪录片',C:AR},{D:'综艺',C:'7'}]},{S:b,J:'排序',G:[{D:y,C:y},{D:'播放数量',C:A1},{D:'更新时间',C:L},{D:'最高评分',C:AV},{D:'弹幕数量',C:T},{D:'追看人数',C:AR},{D:'开播时间',C:'5'},{D:'上映时间',C:'6'}]},{S:C5,J:'付费',G:[{D:'全部',C:'-1'},{D:'免费',C:T},{D:'付费',C:'2%2C6'},{D:'大会员',C:'4%2C6'}]}],Ae:[{S:b,J:'排序',G:[{D:'近期热门',C:'hot'},{D:'月播放量',C:Az},{D:'最新投稿',C:'new'},{D:'频道精选',C:Cl}]}],Af:[{S:b,J:'排序',G:[{D:'收藏时间',C:'mtime'},{D:'播放量',C:Az},{D:'投稿时间',C:'pubtime'}]}],BG:[{S:r,J:'分类',G:[{D:'全部',C:BW},{D:'视频',C:BN},{D:AH,C:AW},{D:BM,C:BM},{D:BT,C:BT}]}],BH:[{S:r,J:'类型',G:[{D:'视频',C:AB},{D:'番剧',C:D0},{D:Ad,C:D1},{D:AH,C:AW},{D:'用户',C:C7}]},{S:b,J:'视频排序',G:[{D:'综合排序',C:Cn},{D:'最多点击',C:'click'},{D:'最新发布',C:Ai},{D:'最多收藏',C:'stow'},{D:'最多弹幕',C:'dm'}]},{S:d,J:'视频时长',G:[{D:'全部',C:L},{D:'60分钟以上',C:AV},{D:'30~60分钟',C:AR},{D:'5~30分钟',C:A1},{D:'5分钟以下',C:T}]}]}};header={'Origin':Bu,D7:Bu,A9:'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_2_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15'}
  1389. def localProxy(A,param):return[200,'video/MP2T',action,B]