哔哩影视.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /**
  2. * 影视TV 弹幕支持
  3. * https://t.me/fongmi_offical/
  4. * https://github.com/FongMi/Release/tree/main/apk
  5. * Cookie设置
  6. * Cookie获取方法 https://ghproxy.net/https://raw.githubusercontent.com/UndCover/PyramidStore/main/list.md
  7. * Cookie设置方法1: DR-PY 后台管理界面
  8. * CMS后台管理 > 设置中心 > 环境变量 > {"bili_cookie":"XXXXXXX","vmid":"XXXXXX"} > 保存
  9. * Cookie设置方法2: 手动替换Cookie
  10. * 底下代码 headers的
  11. * "Cookie":"$bili_cookie"
  12. * 手动替换为
  13. * "Cookie":"将获取的Cookie黏贴在这"
  14. * 客户端长期Cookie设置教程:
  15. * 抓包哔哩手机端搜索access_key,取任意链接里的access_key和appkey在drpy环境变量中增加同名的环境变量即可
  16. * 此时哔哩.js这个解析可用于此源的解析线路用
  17. */
  18. var rule = {
  19. title:'哔哩影视',
  20. host:'https://api.bilibili.com',
  21. url:'/fyclass-fypage&vmid=$vmid',
  22. detailUrl:'/pgc/view/web/season?season_id=fyid',
  23. filter_url:'fl={{fl}}',
  24. vmid获取教程:'登录后访问https://api.bilibili.com/x/web-interface/nav,搜索mid就是,cookie需要 bili_jct,DedeUserID,SESSDATA参数',
  25. searchUrl:'/x/web-interface/search/type?keyword=**&page=fypage&search_type=',
  26. searchable:1,
  27. filterable:1,
  28. quickSearch:0,
  29. headers:{
  30. 'User-Agent':'PC_UA',
  31. "Referer": "https://www.bilibili.com",
  32. "Cookie":"buvid3=4AE65483-AE8B-4B8A-9E70-2ECB290F8012148796infoc; b_nut=1638236210; CURRENT_FNVAL=4048; buvid4=03F9D01F-919E-5301-CAA4-E0D626C40D0223816-022032520-GlymH7ZVG/nfW6G7DmiQwg%3D%3D; rpdid=|(k|YkRlYRmY0J'uY~|kklRYu; fingerprint=bcec6f62cbb8f0328e2988cab1530e3a; buvid_fp_plain=undefined; PVID=1; buvid_fp=bcec6f62cbb8f0328e2988cab1530e3a; DedeUserID=392430248; DedeUserID__ckMd5=92fb669487f062b2; CURRENT_QUALITY=80; enable_web_push=DISABLE; header_theme_version=CLOSE; home_feed_column=5; _uuid=761043F107-DE87-633C-363F-8819292710410B14945infoc; FEED_LIVE_VERSION=V8; LIVE_BUVID=AUTO3317128964866191; b_lsid=B9102CEAF_191731B0EF5; browser_resolution=2492-1286; SESSDATA=5dc6c209%2C1739765039%2C4c250%2A81CjCO1hbhlsG2OBK1ywlf8ElfP4tSvjudU2VLexbRZSqhP0Pvl1chp2xI3Zo-r2Vlv6wSVm92SnRCMGtWODUxQTJMcVR0ekFqNlpVR1dBazBsMDVMWlRZdVZLd1pnb25sVG9ZbEotUEktVFFJbl8xY25pZ3pSYWFpQ2ozSTR4bkJqQ1BtcEVJQmhBIIEC; bili_jct=de1027728bcc9bcbeec1765bdc1c2b10; sid=h55ubmev; bili_ticket=eyJhbGciOiJIUzI1NiIsImtpZCI6InMwMyIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjQ0NzIyNDQsImlhdCI6MTcyNDIxMjk4NCwicGx0IjotMX0.tk7ycdAznYjPId355nkSr2CQrc5YcBS0kAdrMmd01tE; bili_ticket_expires=1724472184"
  33. },
  34. timeout:5000,
  35. class_name:'番剧&国创&电影&电视剧&纪录片&综艺&全部&追番&追剧&时间表',
  36. class_url:'1&4&2&5&3&7&全部&追番&追剧&时间表',
  37. filter:{"全部":[{"key":"tid","name":"分类","value":[{"n":"番剧","v":"1"},{"n":"国创","v":"4"},{"n":"电影","v":"2"},{"n":"电视剧","v":"5"},{"n":"记录片","v":"3"},{"n":"综艺","v":"7"}]},{"key":"order","name":"排序","value":[{"n":"播放数量","v":"2"},{"n":"更新时间","v":"0"},{"n":"最高评分","v":"4"},{"n":"弹幕数量","v":"1"},{"n":"追看人数","v":"3"},{"n":"开播时间","v":"5"},{"n":"上映时间","v":"6"}]},{"key":"season_status","name":"付费","value":[{"n":"全部","v":"-1"},{"n":"免费","v":"1"},{"n":"付费","v":"2%2C6"},{"n":"大会员","v":"4%2C6"}]}],"时间表":[{"key":"tid","name":"分类","value":[{"n":"番剧","v":"1"},{"n":"国创","v":"4"}]}]},
  38. play_parse:true,
  39. // play_json:[{re:'*', json:{jx:1, parse:0,header:JSON.stringify({"user-agent":"PC_UA"})}}],
  40. pagecount:{"1":1,"2":1,"3":1,"4":1,"5":1,"7":1,"时间表":1},
  41. lazy:'',
  42. limit:5,
  43. 推荐:'',
  44. 推荐:'js:let d=[];function get_result(url){let videos=[];let html=request(url);let jo=JSON.parse(html);if(jo["code"]===0){let vodList=jo.result?jo.result.list:jo.data.list;vodList.forEach(function(vod){let aid=(vod["season_id"]+"").trim();let title=vod["title"].trim();let img=vod["cover"].trim();let remark=vod.new_ep?vod["new_ep"]["index_show"]:vod["index_show"];videos.push({vod_id:aid,vod_name:title,vod_pic:img,vod_remarks:remark})})}return videos}function get_rank(tid,pg){return get_result("https://api.bilibili.com/pgc/web/rank/list?season_type="+tid+"&pagesize=20&page="+pg+"&day=3")}function get_rank2(tid,pg){return get_result("https://api.bilibili.com/pgc/season/rank/web/list?season_type="+tid+"&pagesize=20&page="+pg+"&day=3")}function home_video(){let videos=get_rank(1).slice(0,5);[4,2,5,3,7].forEach(function(i){videos=videos.concat(get_rank2(i).slice(0,5))});return videos}VODS=home_video();',
  45. 一级:'',
  46. 一级:'js:let d=[];let vmid=input.split("vmid=")[1].split("&")[0];function get_result(url){let videos=[];let html=request(url);let jo=JSON.parse(html);if(jo["code"]===0){let vodList=jo.result?jo.result.list:jo.data.list;vodList.forEach(function(vod){let aid=(vod["season_id"]+"").trim();let title=vod["title"].trim();let img=vod["cover"].trim();let remark=vod.new_ep?vod["new_ep"]["index_show"]:vod["index_show"];videos.push({vod_id:aid,vod_name:title,vod_pic:img,vod_remarks:remark})})}return videos}function get_rank(tid,pg){return get_result("https://api.bilibili.com/pgc/web/rank/list?season_type="+tid+"&pagesize=20&page="+pg+"&day=3")}function get_rank2(tid,pg){return get_result("https://api.bilibili.com/pgc/season/rank/web/list?season_type="+tid+"&pagesize=20&page="+pg+"&day=3")}function get_zhui(pg,mode){let url="https://api.bilibili.com/x/space/bangumi/follow/list?type="+mode+"&follow_status=0&pn="+pg+"&ps=10&vmid="+vmid;return get_result(url)}function get_all(tid,pg,order,season_status){let url="https://api.bilibili.com/pgc/season/index/result?order="+order+"&pagesize=20&type=1&season_type="+tid+"&page="+pg+"&season_status="+season_status;return get_result(url)}function get_timeline(tid,pg){let videos=[];let url="https://api.bilibili.com/pgc/web/timeline/v2?season_type="+tid+"&day_before=2&day_after=4";let html=request(url);let jo=JSON.parse(html);if(jo["code"]===0){let videos1=[];let vodList=jo.result.latest;vodList.forEach(function(vod){let aid=(vod["season_id"]+"").trim();let title=vod["title"].trim();let img=vod["cover"].trim();let remark=vod["pub_index"]+" "+vod["follows"].replace("系列","");videos1.push({vod_id:aid,vod_name:title,vod_pic:img,vod_remarks:remark})});let videos2=[];for(let i=0;i<7;i++){let vodList=jo["result"]["timeline"][i]["episodes"];vodList.forEach(function(vod){if(vod["published"]+""==="0"){let aid=(vod["season_id"]+"").trim();let title=vod["title"].trim();let img=vod["cover"].trim();let date=vod["pub_ts"];let remark=date+" "+vod["pub_index"];videos2.push({vod_id:aid,vod_name:title,vod_pic:img,vod_remarks:remark})}})}videos=videos2.concat(videos1)}return videos}function cate_filter(d,cookie){if(MY_CATE==="1"){return get_rank(MY_CATE,MY_PAGE)}else if(["2","3","4","5","7"].includes(MY_CATE)){return get_rank2(MY_CATE,MY_PAGE)}else if(MY_CATE==="全部"){let tid=MY_FL.tid||"1";let order=MY_FL.order||"2";let season_status=MY_FL.season_status||"-1";return get_all(tid,MY_PAGE,order,season_status)}else if(MY_CATE==="追番"){return get_zhui(MY_PAGE,1)}else if(MY_CATE==="追剧"){return get_zhui(MY_PAGE,2)}else if(MY_CATE==="时间表"){let tid=MY_FL.tid||"1";return get_timeline(tid,MY_PAGE)}else{return[]}}VODS=cate_filter();',
  47. 二级:{
  48. is_json:true,
  49. title:".result.title;.result.share_sub_title",
  50. img:".result.cover",
  51. desc:".result.new_ep.desc;.result.publish.pub_time;.result.subtitle",
  52. content:".result.evaluate",
  53. tabs:"js:pdfa=jsp.pdfa;TABS=['B站']",
  54. lists:".result.episodes",
  55. list_text:'title',
  56. list_url:'cid',
  57. },
  58. 二级:'',
  59. 二级:'js:function zh(num){let p="";if(Number(num)>1e8){p=(num/1e8).toFixed(2)+"亿"}else if(Number(num)>1e4){p=(num/1e4).toFixed(2)+"万"}else{p=num}return p}let html=request(input);let jo=JSON.parse(html).result;let id=jo["season_id"];let title=jo["title"];let pic=jo["cover"];let areas=jo["areas"][0]["name"];let typeName=jo["share_sub_title"];let date=jo["publish"]["pub_time"].substr(0,4);let dec=jo["evaluate"];let remark=jo["new_ep"]["desc"];let stat=jo["stat"];let status="弹幕: "+zh(stat["danmakus"])+" 点赞: "+zh(stat["likes"])+" 投币: "+zh(stat["coins"])+" 追番追剧: "+zh(stat["favorites"]);let score=jo.hasOwnProperty("rating")?"评分: "+jo["rating"]["score"]+" "+jo["subtitle"]:"暂无评分"+" "+jo["subtitle"];let vod={vod_id:id,vod_name:title,vod_pic:pic,type_name:typeName,vod_year:date,vod_area:areas,vod_remarks:remark,vod_actor:status,vod_director:score,vod_content:dec};let ja=jo["episodes"];let playurls1=[];let playurls2=[];ja.forEach(function(tmpJo){let eid=tmpJo["id"];let cid=tmpJo["cid"];let link=tmpJo["link"];let part=tmpJo["title"].replace("#","-")+" "+tmpJo["long_title"];playurls1.push(part+"$"+eid+"_"+cid);playurls2.push(part+"$"+link)});let playUrl=playurls1.join("#")+"$$$"+playurls2.join("#");vod["vod_play_from"]="B站$$$bilibili";vod["vod_play_url"]=playUrl;VOD=vod;',
  60. 搜索:'',
  61. 搜索:'js:let url1=input+"media_bangumi";let url2=input+"media_ft";let html=request(url1);let msg=JSON.parse(html).message;if(msg!=="0"){VODS=[{vod_name:KEY+"➢"+msg,vod_id:"no_data",vod_remarks:"别点,缺少bili_cookie",vod_pic:"https://ghproxy.net/https://raw.githubusercontent.com/hjdhnx/dr_py/main/404.jpg"}]}else{let jo1=JSON.parse(html).data;html=request(url2);let jo2=JSON.parse(html).data;let videos=[];let vodList=[];if(jo1["numResults"]===0){vodList=jo2["result"]}else if(jo2["numResults"]===0){vodList=jo1["result"]}else{vodList=jo1["result"].concat(jo2["result"])}vodList.forEach(function(vod){let aid=(vod["season_id"]+"").trim();let title=KEY+"➢"+vod["title"].trim().replace(\'<em class="keyword">\',"").replace("</em>","");let img=vod["cover"].trim();let remark=vod["index_show"];videos.push({vod_id:aid,vod_name:title,vod_pic:img,vod_remarks:remark})});VODS=videos}',
  62. lazy:'',
  63. lazy:`js:
  64. if (/^http/.test(input)) {
  65. input = {
  66. jx: 1,
  67. url: input,
  68. parse: 0,
  69. header: JSON.stringify({
  70. "user-agent": "Mozilla/5.0"
  71. })
  72. }
  73. } else {
  74. let ids = input.split("_");
  75. let dan = 'https://api.bilibili.com/x/v1/dm/list.so?oid=' + ids[1];
  76. let result = {};
  77. let url = "https://api.bilibili.com/pgc/player/web/playurl?qn=116&ep_id=" + ids[0] + "&cid=" + ids[1];
  78. let html = request(url);
  79. let jRoot = JSON.parse(html);
  80. if (jRoot["message"] !== "success") {
  81. print("需要大会员权限才能观看");
  82. input = ""
  83. } else {
  84. let jo = jRoot["result"];
  85. let ja = jo["durl"];
  86. let maxSize = -1;
  87. let position = -1;
  88. ja.forEach(function(tmpJo, i) {
  89. if (maxSize < Number(tmpJo["size"])) {
  90. maxSize = Number(tmpJo["size"]);
  91. position = i
  92. }
  93. });
  94. let url = "";
  95. if (ja.length > 0) {
  96. if (position === -1) {
  97. position = 0
  98. }
  99. url = ja[position]["url"]
  100. }
  101. result["parse"] = 0;
  102. result["playUrl"] = "";
  103. result["url"] = url;
  104. result["header"] = {
  105. Referer: "https://www.bilibili.com",
  106. "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"
  107. };
  108. result["contentType"] = "video/x-flv";
  109. result["danmaku"] = dan;
  110. input = result
  111. }
  112. }
  113. `,
  114. }