cntv_open_cctv910.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. // 无搜索功能
  2. import { _ } from "./lib/cat.js";
  3. let key = 'CCTV9纪录科教';
  4. let HOST = 'http://api.cntv.cn';
  5. let siteKey = '';
  6. let siteType = 0;
  7. const MOBILE_UA = 'Mozilla/5.0 (Linux; Android 11; M2007J3SC Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045714 Mobile Safari/537.36';
  8. async function request(reqUrl, agentSp) {
  9. let res = await req(reqUrl, {
  10. method: 'get',
  11. headers: {
  12. 'User-Agent': agentSp || MOBILE_UA,
  13. },
  14. });
  15. return res.content
  16. }
  17. async function init(cfg) {
  18. siteKey = cfg.skey;
  19. siteType = cfg.stype
  20. }
  21. async function home(filter) {
  22. const classes = [
  23. {type_id: "TOPC1460958142363297", type_name: "纪录频道"},
  24. {type_id: "TOPC1571389841186799", type_name: "纪录频道·微9"},
  25. {type_id: "TOPC1451557052519584", type_name: "百家讲坛 "},
  26. {type_id: "TOPC1451557421544786", type_name: "地理·中国"},
  27. {type_id: "TOPC1451558150787467", type_name: "自然传奇"},
  28. {type_id: "TOPC1482483166133803", type_name: "味道"},
  29. {type_id: "TOPC1451557646802924", type_name: "健康之路"},
  30. {type_id: "TOPC1451557893544236", type_name: "探索·发现"},
  31. {type_id: "TOPC1576631973420833", type_name: "透视新科技"},
  32. {type_id: "TOPC1571021159595290", type_name: "实验现场"},
  33. {type_id: "TOPC1571021323137369", type_name: "科幻地带"},
  34. {type_id: "TOPC1571021385508957", type_name: "科学动物园"},
  35. {type_id: "TOPC1570874587435537", type_name: "时尚科技秀"},
  36. {type_id: "TOPC1570780618796536", type_name: "人物·故事"},
  37. {type_id: "TOPC1571021251454875", type_name: "考古公开课"},
  38. {type_id: "TOPC1575253587571324", type_name: "跟着书本去旅行"},
  39. {type_id: "TOPC1574995326079121", type_name: "百家说故事"},
  40. {type_id: "TOPC1451557523542854", type_name: "读书"},
  41. {type_id: "TOPC1570876640457386", type_name: "解码科技史"},
  42. {type_id: "TOPC1570875218228998", type_name: "创新进行时"},
  43. {type_id: "TOPC1592552941644815",type_name: "中国影像方志"}
  44. ];
  45. const filterObj = {};
  46. return JSON.stringify({
  47. class: _.map(classes, (cls) => {
  48. cls.land = 1;
  49. cls.ratio = 1.78;
  50. return cls;
  51. }),
  52. filters: filterObj,
  53. })
  54. }
  55. async function homeVod() {
  56. const data = JSON.parse(await request(HOST + '/NewVideo/getVideoListByColumn?id=TOPC1451558856402351&n=10&sort=desc&p=1&mode=0&serviceId=tvcctv'));
  57. let videos = _.map(data.data.list, (it) => {
  58. return {
  59. vod_id: it.guid,
  60. vod_name: it.title,
  61. vod_pic: it.image,
  62. vod_remarks: it.time || '',
  63. }
  64. });
  65. return JSON.stringify({
  66. list: videos,
  67. })
  68. }
  69. async function category(tid, pg, filter, extend) {
  70. if (pg <= 0 || typeof pg == 'undefined') pg = 1;
  71. const data = JSON.parse(await request(HOST + '/NewVideo/getVideoListByColumn?id=' + tid + '&n=10&sort=desc&p=' + pg + '&mode=0&serviceId=tvcctv'));
  72. let videos = _.map(data.data.list, (it) => {
  73. return {
  74. vod_id: it.guid,
  75. vod_name: it.title,
  76. vod_pic: it.image,
  77. vod_remarks: it.time || '',
  78. }
  79. });
  80. const pgChk = JSON.parse(await request(HOST + '/NewVideo/getVideoListByColumn?id=' + tid + '&n=10&sort=desc&p=' + (parseInt(pg) + 1) + '&mode=0&serviceId=tvcctv')).data.list;
  81. const pgCount = pgChk.length > 0 ? parseInt(pg) + 1 : parseInt(pg);
  82. return JSON.stringify({
  83. page: parseInt(pg),
  84. pagecount: parseInt(pgCount),
  85. limit: 10,
  86. total: parseInt(data.total),
  87. list: videos,
  88. })
  89. }
  90. async function detail(id) {
  91. const vod = {
  92. vod_id: id,
  93. vod_remarks: '',
  94. };
  95. //const playlist = ['点击播放' + '$' + 'https://hls.cntv.myhwcdn.cn/asp/hls/2000/0303000a/3/default/' + id + '/2000.m3u8'];
  96. //const playlist = ['点击播放' + '$' + 'https://newcntv.qcloudcdn.com/asp/hls/main/0303000a/3/default/' + id + '/2000.m3u8'];
  97. //const playlist = ['点击播放' + '$' + 'https://hls.cntv.cdn20.com/asp/hls/2000/0303000a/3/default/' + id + '/2000.m3u8'];
  98. //const playlist = ['点击播放' + '$' + 'https://hls.cntv.myalicdn.com//asp/hls/2000/0303000a/3/default/' + id + '/2000.m3u8'];
  99. const playlist = ['点击播放' + '$' + 'https://dh5.cntv.myhwcdn.cn/asp//hls/2000/0303000a/3/default/' + id + '/2000.m3u8'];
  100. vod.vod_play_from = key;
  101. vod.vod_play_url = playlist.join('#');
  102. return JSON.stringify({
  103. list: [vod],
  104. });
  105. }
  106. async function play(flag, id, flags) {
  107. // console.debug('视聚场 id =====>' + id); // js_debug.log
  108. return JSON.stringify({
  109. parse: 0,
  110. url: id,
  111. })
  112. }
  113. async function search(wd, quick, pg) {
  114. return '{}'
  115. }
  116. export function __jsEvalReturn() {
  117. return {
  118. init: init,
  119. home: home,
  120. homeVod: homeVod,
  121. category: category,
  122. detail: detail,
  123. play: play,
  124. search: search,
  125. }
  126. }