哔哩二级.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. js:
  2. // 将超过10000的数字换成成以万和亿为单位
  3. function zh(num){
  4. let p='';
  5. if(Number(num)>100000000){
  6. p = (num/100000000).toFixed(2)+'亿';
  7. }else if(Number(num)>10000){
  8. p = (num/10000).toFixed(2)+'万';
  9. }else{
  10. p = num;
  11. }
  12. return p
  13. }
  14. let html = request(input);
  15. let jo = JSON.parse(html).result;
  16. let id = jo['season_id'];
  17. let title = jo['title'];
  18. let pic = jo['cover'];
  19. let areas = jo['areas'][0]['name'];
  20. let typeName = jo['share_sub_title'];
  21. let date = jo['publish']['pub_time'].substr(0,4);
  22. let dec = jo['evaluate'];
  23. let remark = jo['new_ep']['desc'];
  24. let stat = jo['stat'];
  25. let status = "弹幕: " + zh(stat['danmakus']) + " 点赞: " + zh(stat['likes']) + " 投币: " + zh(stat['coins']) + " 追番追剧: " + zh(stat['favorites']);
  26. let score = jo.hasOwnProperty('rating')?"评分: " + jo['rating']['score'] + ' ' + jo['subtitle']:"暂无评分" + ' ' + jo['subtitle'];
  27. let vod = {
  28. "vod_id": id,
  29. "vod_name": title,
  30. "vod_pic": pic,
  31. "type_name": typeName,
  32. "vod_year": date,
  33. "vod_area": areas,
  34. "vod_remarks": remark,
  35. "vod_actor": status,
  36. "vod_director": score,
  37. "vod_content": dec
  38. }
  39. let ja = jo['episodes'];
  40. let playurls1 = [];
  41. let playurls2 = [];
  42. ja.forEach(function (tmpJo){
  43. let eid = tmpJo['id'];
  44. let cid = tmpJo['cid'];
  45. let link = tmpJo['link'];
  46. let part = tmpJo['title'].replace("#", "-")+' '+tmpJo['long_title'];
  47. playurls1.push(part+'$'+eid+'_'+cid);
  48. playurls2.push(part+'$'+link);
  49. });
  50. let playUrl = playurls1.join('#')+'$$$'+playurls2.join('#');
  51. vod['vod_play_from'] = 'B站$$$bilibili'
  52. vod['vod_play_url'] = playUrl
  53. VOD = vod;