mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
1 line
1.1 KiB
JavaScript
1 line
1.1 KiB
JavaScript
(()=>{return()=>{class i{constructor(i){this.aid=i}async fetchInfo(){const i=JSON.parse(await downloadText(`https://api.bilibili.com/x/web-interface/view?aid=${this.aid}`));if(i.code!==0){throw new Error(i.message)}const t=i.data;this.cid=t.cid;this.pageCount=t.videos;this.coverUrl=t.pic;this.tagId=t.tid;this.tagName=t.tname;this.title=t.title;this.description=t.desc;this.up={uid:t.owner.mid,name:t.owner.name,faceUrl:t.owner.face};this.pages=t.pages.map(i=>{return{cid:i.cid,title:i.part,pageNumber:i.page}});return this}}class t{constructor(i){this.ep=i;this.videos=[]}async fetchInfo(){const t=await downloadText(`https://www.bilibili.com/bangumi/play/ep${this.ep}/`);const e=JSON.parse(t.match(/window\.__INITIAL_STATE__=(.*);\(function\(\){/)[1]);this.title=e.mediaInfo.title;this.cover=e.mediaInfo.cover;this.squareCover=e.mediaInfo.square_cover;this.aid=e.epInfo.aid;this.cid=e.epInfo.cid;this.videos=e.epList.map(async t=>{return{title:t.index_title,aid:t.aid,cid:t.cid,info:await new i(t.aid).fetchInfo()}});return this}}return{export:{VideoInfo:i,BangumiInfo:t}}}})(); |