哔哩搜索.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. js:
  2. let url1 = input+'media_bangumi';
  3. let url2 = input+'media_ft';
  4. let html = request(url1);
  5. let msg = JSON.parse(html).message;
  6. if(msg!=='0'){
  7. VODS = [{vod_name:KEY + '➢'+msg,vod_id:'no_data',vod_remarks:'别点,缺少bili_cookie',vod_pic:'https://ghproxy.com/https://raw.githubusercontent.com/hjdhnx/dr_py/main/404.jpg'}];
  8. }else {
  9. let jo1 = JSON.parse(html).data;
  10. html = request(url2);
  11. let jo2 = JSON.parse(html).data;
  12. let videos = [];
  13. let vodList = [];
  14. if (jo1['numResults'] === 0) {
  15. vodList = jo2['result'];
  16. } else if (jo2['numResults'] === 0) {
  17. vodList = jo1['result'];
  18. } else {
  19. vodList = jo1['result'].concat(jo2['result']);
  20. }
  21. vodList.forEach(function (vod) {
  22. let aid = (vod['season_id'] + '').trim();
  23. let title = KEY + '➢' + vod['title'].trim().replace("<em class=\"keyword\">", "").replace("</em>", "");
  24. let img = vod['cover'].trim();
  25. let remark = vod['index_show'];
  26. videos.push({
  27. "vod_id": aid,
  28. "vod_name": title,
  29. "vod_pic": img,
  30. "vod_remarks": remark
  31. });
  32. });
  33. VODS = videos;
  34. }