央视聚场.js 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. // 无搜索功能
  2. import { _ } from 'assets://js/lib/cat.js';
  3. let key = '央视聚场';
  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: "TOPC1451559025546574", type_name: "动画大放映" },
  24. { type_id: "TOPC1451378857272262", type_name: "第一动画乐园" },
  25. { type_id: "TOPC1451557646802924", type_name: "健康之路" },
  26. { type_id: "TOPC1451558190239536", type_name: "走进科学" },
  27. { type_id: "TOPC1451557893544236", type_name: "探索·发现" },
  28. { type_id: "TOPC1451378967257534", type_name: "动物世界" },
  29. { type_id: "TOPC1451525103989666", type_name: "人与自然" },
  30. { type_id: "TOPC1451558150787467", type_name: "自然传奇" },
  31. { type_id: "TOPC1451557421544786", type_name: "地理·中国" },
  32. { type_id: "TOPC1451541349400938", type_name: "远方的家" },
  33. { type_id: "TOPC1575253587571324", type_name: "跟着书本去旅行" },
  34. { type_id: "TOPC1451557052519584", type_name: "百家讲坛" },
  35. { type_id: "TOPC1451558856402351", type_name: "空中剧院" },
  36. { type_id: "TOPC1451550970356385", type_name: "体坛快讯" },
  37. { type_id: "TOPC1451528971114112", type_name: "新闻联播" },
  38. { type_id: "TOPC1451558976694518", type_name: "焦点访谈" },
  39. { type_id: "TOPC1451464665008914", type_name: "今日说法" },
  40. { type_id: "TOPC1451378757637200", type_name: "等着我" },
  41. { type_id: "TOPC1451559129520755", type_name: "新闻直播间" },
  42. { type_id: "TOPC1451540328102649", type_name: "海峡两岸" },
  43. { type_id: "TOPC1451530382483536", type_name: "天网" },
  44. { type_id: "TOPC1451540389082713", type_name: "今日关注" },
  45. { type_id: "TOPC1665739007799851", type_name: "高端访谈" },
  46. { type_id: "TOPC1451464884159276", type_name: "开讲啦" },
  47. { type_id: "TOPC1451464884159276", type_name: "故事里的中国" },
  48. { type_id: "TOPC1514182710380601", type_name: "对话" },
  49. { type_id: "TOPC1451559038345600", type_name: "面对面" },
  50. { type_id: "TOPC1451534366388377", type_name: "是真的吗" },
  51. { type_id: "TOPC1451467630488780", type_name: "星光大道" },
  52. { type_id: "TOPC1451541414450906", type_name: "精彩音乐汇" },
  53. { type_id: "TOPC1451534421925242", type_name: "音乐厅" },
  54. { type_id: "TOPC1451541994820527", type_name: "民歌·中国" },
  55. { type_id: "TOPC1451354597100320", type_name: "中国电影报道" },
  56. { type_id: "TOPC1451469943519994", type_name: "星推荐" },
  57. { type_id: "TOPC1571217727564820", type_name: "方圆剧阵" },
  58. { type_id: "TOPC1650782829200997", type_name: "正大综艺" },
  59. { type_id: "TOPC1451530259915198", type_name: "第一时间" },
  60. { type_id: "TOPC1451465894294259", type_name: "开门大吉" },
  61. { type_id: "TOPC1451464884159276", type_name: "开讲啦" },
  62. { type_id: "TOPC1451558858788377", type_name: "共同关注" },
  63. { type_id: "TOPC1451527941788652", type_name: "军事报道" },
  64. { type_id: "TOPC1451558819463311", type_name: "新闻调查" },
  65. { type_id: "TOPC1451559097947700", type_name: "新闻30分" },
  66. { type_id: "TOPC1451559066181661", type_name: "新闻1+1" },
  67. { type_id: "TOPC1451540448405749", type_name: "今日亚洲" },
  68. { type_id: "TOPC1451559129520755", type_name: "新闻直播间" },
  69. { type_id: "TOPC1451558428005729", type_name: "24小时" },
  70. { type_id: "TOPC1451539894330405", type_name: "中国新闻" },
  71. { type_id: "TOPC1451558779639282", type_name: "午夜新闻" },
  72. { type_id: "TOPC1451558496100826", type_name: "朝闻天下" },
  73. { type_id: "TOPC1451528792881669", type_name: "晚间新闻" },
  74. { type_id: "TOPC1451559180488841", type_name: "新闻周刊" },
  75. { type_id: "TOPC1601362002656197", type_name: "经济半小时" },
  76. { type_id: "TOPC1451533652476962", type_name: "经济大讲堂" },
  77. { type_id: "TOPC1453100395512779", type_name: "正点财经" },
  78. { type_id: "TOPC1451546588784893", type_name: "生活圈" },
  79. { type_id: "TOPC1451526037568184", type_name: "生活提示" },
  80. { type_id: "TOPC1451558532019883", type_name: "东方时空" },
  81. { type_id: "TOPC1451533782742171", type_name: "经济信息联播" },
  82. { type_id: "TOPC1571034705435323", type_name: "今日环球" },
  83. { type_id: "TOPC1451543462858283", type_name: "一线" }
  84. ];
  85. const filterObj = {};
  86. return JSON.stringify({
  87. class: _.map(classes, (cls) => {
  88. cls.land = 1;
  89. cls.ratio = 1.78;
  90. return cls;
  91. }),
  92. filters: filterObj,
  93. })
  94. }
  95. async function homeVod() {
  96. const data = JSON.parse(await request(HOST + '/NewVideo/getVideoListByColumn?id=TOPC1451558856402351&n=10&sort=desc&p=1&mode=0&serviceId=tvcctv'));
  97. let videos = _.map(data.data.list, (it) => {
  98. return {
  99. vod_id: it.guid,
  100. vod_name: it.title,
  101. vod_pic: it.image,
  102. vod_remarks: it.time || '',
  103. }
  104. });
  105. return JSON.stringify({
  106. list: videos,
  107. })
  108. }
  109. async function category(tid, pg, filter, extend) {
  110. if (pg <= 0 || typeof pg == 'undefined') pg = 1;
  111. const data = JSON.parse(await request(HOST + '/NewVideo/getVideoListByColumn?id=' + tid + '&n=10&sort=desc&p=' + pg + '&mode=0&serviceId=tvcctv'));
  112. let videos = _.map(data.data.list, (it) => {
  113. return {
  114. vod_id: it.guid,
  115. vod_name: it.title,
  116. vod_pic: it.image,
  117. vod_remarks: it.time || '',
  118. }
  119. });
  120. 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;
  121. const pgCount = pgChk.length > 0 ? parseInt(pg) + 1 : parseInt(pg);
  122. return JSON.stringify({
  123. page: parseInt(pg),
  124. pagecount: parseInt(pgCount),
  125. limit: 10,
  126. total: parseInt(data.total),
  127. list: videos,
  128. })
  129. }
  130. async function detail(id) {
  131. const vod = {
  132. vod_id: id,
  133. vod_remarks: '',
  134. };
  135. const playlist = ['点击播放' + '$' + 'https://hls.cntv.myhwcdn.cn/asp/hls/2000/0303000a/3/default/' + id + '/2000.m3u8'];
  136. vod.vod_play_from = key;
  137. vod.vod_play_url = playlist.join('#');
  138. return JSON.stringify({
  139. list: [vod],
  140. });
  141. }
  142. async function play(flag, id, flags) {
  143. // console.debug('视聚场 id =====>' + id); // js_debug.log
  144. return JSON.stringify({
  145. parse: 0,
  146. url: id,
  147. })
  148. }
  149. async function search(wd, quick, pg) {
  150. return '{}'
  151. }
  152. export function __jsEvalReturn() {
  153. return {
  154. init: init,
  155. home: home,
  156. homeVod: homeVod,
  157. category: category,
  158. detail: detail,
  159. play: play,
  160. search: search,
  161. }
  162. }