cntv_open_cctv14.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. // 无搜索功能
  2. import { _ } from "./lib/cat.js";
  3. let key = 'CCTV14少儿频道';
  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: "TOPC1451559836238828", type_name: "周末动画片"},
  24. {type_id: "TOPC1451559479171411", type_name: "快乐体验"},
  25. {type_id: "TOPC1451559205464876", type_name: "小小智慧树"},
  26. {type_id: "TOPC1451559756374759", type_name: "智力快车"},
  27. {type_id: "TOPC1451559666055645", type_name: "音乐快递"},
  28. {type_id: "TOPC1451559695702690", type_name: "英雄出少年"},
  29. {type_id: "TOPC1451559161446811", type_name: "快乐大巴"},
  30. {type_id: "TOPC1451559448233349", type_name: "动漫世界"},
  31. {type_id: "TOPC1451559603261584", type_name: "新闻袋袋裤"},
  32. {type_id: "TOPC1451558929123462", type_name: "大风车"},
  33. {type_id: "TOPC1451559569040502", type_name: "七巧板"},
  34. {type_id: "TOPC1451558967135492", type_name: "大手牵小手"},
  35. {type_id: "TOPC1451447359806385", type_name: "智慧树"},
  36. {type_id: "TOPC1451559378830189", type_name: "动感特区"},
  37. {type_id: "TOPC1451559025546574", type_name: "动画大放映"},
  38. {type_id: "TOPC1451559131256781", type_name: "看我72变"},
  39. {type_id: "TOPC1628144739712839", type_name: "快乐童行"},
  40. {type_id: "TOPC1573528152700717",type_name: "风车剧场"}
  41. ];
  42. const filterObj = {};
  43. return JSON.stringify({
  44. class: _.map(classes, (cls) => {
  45. cls.land = 1;
  46. cls.ratio = 1.78;
  47. return cls;
  48. }),
  49. filters: filterObj,
  50. })
  51. }
  52. async function homeVod() {
  53. const data = JSON.parse(await request(HOST + '/NewVideo/getVideoListByColumn?id=TOPC1451558856402351&n=10&sort=desc&p=1&mode=0&serviceId=tvcctv'));
  54. let videos = _.map(data.data.list, (it) => {
  55. return {
  56. vod_id: it.guid,
  57. vod_name: it.title,
  58. vod_pic: it.image,
  59. vod_remarks: it.time || '',
  60. }
  61. });
  62. return JSON.stringify({
  63. list: videos,
  64. })
  65. }
  66. async function category(tid, pg, filter, extend) {
  67. if (pg <= 0 || typeof pg == 'undefined') pg = 1;
  68. const data = JSON.parse(await request(HOST + '/NewVideo/getVideoListByColumn?id=' + tid + '&n=10&sort=desc&p=' + pg + '&mode=0&serviceId=tvcctv'));
  69. let videos = _.map(data.data.list, (it) => {
  70. return {
  71. vod_id: it.guid,
  72. vod_name: it.title,
  73. vod_pic: it.image,
  74. vod_remarks: it.time || '',
  75. }
  76. });
  77. 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;
  78. const pgCount = pgChk.length > 0 ? parseInt(pg) + 1 : parseInt(pg);
  79. return JSON.stringify({
  80. page: parseInt(pg),
  81. pagecount: parseInt(pgCount),
  82. limit: 10,
  83. total: parseInt(data.total),
  84. list: videos,
  85. })
  86. }
  87. async function detail(id) {
  88. const vod = {
  89. vod_id: id,
  90. vod_remarks: '',
  91. };
  92. //const playlist = ['点击播放' + '$' + 'https://hls.cntv.myhwcdn.cn/asp/hls/2000/0303000a/3/default/' + id + '/2000.m3u8'];
  93. //const playlist = ['点击播放' + '$' + 'https://newcntv.qcloudcdn.com/asp/hls/main/0303000a/3/default/' + id + '/2000.m3u8'];
  94. //const playlist = ['点击播放' + '$' + 'https://hls.cntv.cdn20.com/asp/hls/2000/0303000a/3/default/' + id + '/2000.m3u8'];
  95. //const playlist = ['点击播放' + '$' + 'https://hls.cntv.myalicdn.com//asp/hls/2000/0303000a/3/default/' + id + '/2000.m3u8'];
  96. const playlist = ['点击播放' + '$' + 'https://dh5.cntv.myhwcdn.cn/asp//hls/2000/0303000a/3/default/' + id + '/2000.m3u8'];
  97. vod.vod_play_from = key;
  98. vod.vod_play_url = playlist.join('#');
  99. return JSON.stringify({
  100. list: [vod],
  101. });
  102. }
  103. async function play(flag, id, flags) {
  104. // console.debug('视聚场 id =====>' + id); // js_debug.log
  105. return JSON.stringify({
  106. parse: 0,
  107. url: id,
  108. })
  109. }
  110. async function search(wd, quick, pg) {
  111. return '{}'
  112. }
  113. export function __jsEvalReturn() {
  114. return {
  115. init: init,
  116. home: home,
  117. homeVod: homeVod,
  118. category: category,
  119. detail: detail,
  120. play: play,
  121. search: search,
  122. }
  123. }