哔哩一级.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. js:
  2. let d = [];
  3. let vmid = input.split("vmid=")[1].split("&")[0];
  4. function get_result(url){
  5. let videos = [];
  6. let html = request(url);
  7. let jo = JSON.parse(html);
  8. if(jo['code'] === 0){
  9. let vodList = jo.result?jo.result.list:jo.data.list;
  10. vodList.forEach(function (vod){
  11. let aid = (vod['season_id']+'').trim();
  12. let title = vod['title'].trim();
  13. let img = vod['cover'].trim();
  14. let remark = vod.new_ep?vod['new_ep']['index_show']:vod['index_show'];
  15. videos.push({
  16. "vod_id": aid,
  17. "vod_name": title,
  18. "vod_pic": img,
  19. "vod_remarks": remark
  20. });
  21. });
  22. }
  23. return videos;
  24. }
  25. function get_rank(tid,pg){
  26. return get_result('https://api.bilibili.com/pgc/web/rank/list?season_type='+tid+'&pagesize=20&page='+pg+'&day=3')
  27. }
  28. function get_rank2(tid,pg){
  29. return get_result('https://api.bilibili.com/pgc/season/rank/web/list?season_type='+tid+'&pagesize=20&page='+pg+'&day=3')
  30. }
  31. function get_zhui(pg,mode){
  32. let url = 'https://api.bilibili.com/x/space/bangumi/follow/list?type='+mode+'&follow_status=0&pn='+pg+'&ps=10&vmid='+vmid;
  33. return get_result(url)
  34. }
  35. function get_all(tid, pg, order, season_status){
  36. 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;
  37. return get_result(url)
  38. }
  39. function get_timeline(tid,pg){
  40. let videos = [];
  41. let url = 'https://api.bilibili.com/pgc/web/timeline/v2?season_type='+tid+'&day_before=2&day_after=4';
  42. let html = request(url);
  43. let jo = JSON.parse(html);
  44. if(jo['code'] === 0){
  45. let videos1 = [];
  46. let vodList = jo.result.latest;
  47. vodList.forEach(function (vod){
  48. let aid = (vod['season_id']+'').trim();
  49. let title = vod['title'].trim();
  50. let img = vod['cover'].trim();
  51. let remark = vod['pub_index'] + ' ' + vod['follows'].replace('系列', '');
  52. videos1.push({
  53. "vod_id": aid,
  54. "vod_name": title,
  55. "vod_pic": img,
  56. "vod_remarks": remark
  57. });
  58. });
  59. let videos2 = [];
  60. for(let i=0;i<7;i++){
  61. let vodList = jo['result']['timeline'][i]['episodes'];
  62. vodList.forEach(function (vod){
  63. if((vod['published']+'') === "0"){
  64. let aid = (vod['season_id']+'').trim();
  65. let title = vod['title'].trim();
  66. let img = vod['cover'].trim();
  67. let date = vod['pub_ts'];
  68. let remark = date + " " + vod['pub_index'];
  69. videos2.push({
  70. "vod_id": aid,
  71. "vod_name": title,
  72. "vod_pic": img,
  73. "vod_remarks": remark
  74. });
  75. }
  76. });
  77. }
  78. videos = videos2.concat(videos1);
  79. }
  80. return videos;
  81. }
  82. function cate_filter(d, cookie) {
  83. if (MY_CATE === "1") {
  84. return get_rank(MY_CATE,MY_PAGE)
  85. }else if(['2','3','4','5','7'].includes(MY_CATE)){
  86. return get_rank2(MY_CATE,MY_PAGE)
  87. }else if(MY_CATE==='全部'){
  88. let tid = MY_FL.tid||'1' ;
  89. let order = MY_FL.order||'2';
  90. let season_status = MY_FL.season_status||'-1';
  91. return get_all(tid, MY_PAGE, order, season_status)
  92. }else if(MY_CATE==='追番'){
  93. return get_zhui(MY_PAGE, 1)
  94. }else if(MY_CATE==='追剧'){
  95. return get_zhui(MY_PAGE, 2)
  96. }else if(MY_CATE==='时间表'){
  97. let tid = MY_FL.tid||'1' ;
  98. return get_timeline(tid,MY_PAGE)
  99. }else{
  100. return []
  101. }
  102. }
  103. VODS = cate_filter();
  104. // print(VODS);