ktv_open.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. import { Crypto, load, _ } from 'assets://js/lib/cat.js';
  2. let key = 'ktv';
  3. let HOST = 'http://vpsdn.leuse.top/searchmv';
  4. let mktvUrl = 'http://txysong.mysoto.cc/songs/';
  5. let host = '';
  6. let siteKey = '';
  7. let siteType = 0;
  8. 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';
  9. async function request(reqUrl, extHeader) {
  10. let headers = {
  11. 'User-Agent': MOBILE_UA,
  12. 'Referer': host,
  13. };
  14. const res = await req(reqUrl, {
  15. method: 'get',
  16. headers: headers,
  17. });
  18. return res.content;
  19. }
  20. // cfg = {skey: siteKey, ext: extend}
  21. async function init(cfg) {
  22. siteKey = cfg.skey;
  23. siteType = cfg.stype;
  24. }
  25. async function home(filter) {
  26. let classes = [{
  27. type_id: 1,
  28. type_name: '歌手',
  29. },{
  30. type_id: 2,
  31. type_name: '曲库',
  32. }];
  33. const filterObj = {
  34. 1: [{ key: 'region', name: '地区', init: '', value: [{ n: '全部', v: '' }, { v: '1', n: '大陆' }, { v: '2', n: '港台' }, { v: '3', n: '国外' }] },{ key: 'form', name: '类别', init: '', value: [{ n: '全部', v: '' }, { v: '1', n: '男' }, { v: '2', n: '女' }, { v: '3', n: '组合' }] }],
  35. 2: [{ key: 'lan', name: '语言', init: '2', value: [{ n: '全部', v: '' }, { v: '1', n: '藏语' }, { v: '2', n: '国语' }, { v: '3', n: '韩语' }, { v: '4', n: '日语' }, { v: '5', n: '闽南语' }, { v: '6', n: '英语' }, { v: '7', n: '粤语' }, { v: '8', n: '其他' }, { v: '9', n: '马来语' }, { v: '10', n: '泰语' }, { v: '11', n: '印尼语' }, { v: '12', n: '越南语' }] },{ key: 'type', name: '类型', init: '', value: [{ n: '全部', v: '' }, { v: '1', n: '流行' }, { v: '2', n: '合唱' }, { v: '3', n: '怀旧' },{ v: '4', n: '儿歌' }, { v: '5', n: '革命' }, { v: '6', n: '民歌' }, { v: '7', n: '舞曲' },{ v: '8', n: '喜庆' }, { v: '9', n: '迪高' }, { v: '10', n: '无损DISCO' }, { v: '11', n: '影视' }] }],
  36. };
  37. return JSON.stringify({
  38. class: classes,
  39. filters: filterObj,
  40. });
  41. }
  42. async function homeVod() {
  43. }
  44. async function category(tid, pg, filter, extend) {
  45. if (pg <= 0 || typeof (pg) == 'undefined') pg = 1;
  46. let url = HOST;
  47. let videos = [];
  48. if(tid == 1) {
  49. url = url + `?table=singer&pg=${pg}`;
  50. if(extend['region']) url = url + '&where=region_id&keywords=' + extend['region'];
  51. if(extend['form']) url += '&where=form_id&keywords=' + extend['form'];
  52. console.log(url);
  53. let res = JSON.parse(await request(url));
  54. videos = _.map(res, item => {
  55. return {
  56. vod_id: item.name,
  57. vod_name: item.name,
  58. vod_pic: mktvUrl + item.id + '.jpg',
  59. vod_remarks: '',
  60. }
  61. });
  62. } else if(tid == 2) {
  63. url = url + `?table=song&pg=${pg}`;
  64. if(extend['lan']) url = url + '&where=language_id&keywords=' + extend['lan'];
  65. if(extend['type']) url += '&where=type_id&keywords=' + extend['type'];
  66. let res = JSON.parse(await request(url));
  67. videos = _.map(res, item => {
  68. return {
  69. vod_id: mktvUrl + item.number + '.mkv',
  70. vod_name: item.name,
  71. vod_pic: '',
  72. vod_remarks: '',
  73. }
  74. });
  75. }
  76. return JSON.stringify({
  77. list: videos,
  78. page: pg,
  79. limit: 20,
  80. total: videos.length
  81. });
  82. }
  83. async function detail(id) {
  84. const vod = {
  85. vod_id: id,
  86. vod_name: id,
  87. vod_play_from: 'Leospring',
  88. vod_content: '该影视由💕一个分享者💕采集分享,请勿传播,仅供技术学习使用,请在学习后24小时内删除;由此产生的任何法律风险自行承担,与本作者无关!',
  89. }
  90. if (id.endsWith('.mkv')) {
  91. vod.vod_play_url = '播放$' + id;
  92. } else {
  93. let url = HOST + '?table=song&where=singer_names&keywords=' + id + '&size=999';
  94. let res = JSON.parse(await request(url));
  95. vod.vod_play_url = (_.map(res, item => {
  96. return item.name + '$' + mktvUrl + item.number + '.mkv';
  97. })).join('#');
  98. }
  99. return JSON.stringify({
  100. list: [vod],
  101. });
  102. }
  103. async function play(flag, id, flags) {
  104. return JSON.stringify({
  105. parse: 0,
  106. url: id,
  107. });
  108. }
  109. async function search(wd, quick) {
  110. let data = JSON.parse(await request(HOST + '?keywords=' + wd));
  111. let videos = _.map(data, (it) => {
  112. return {
  113. vod_id: mktvUrl + it.number + '.mkv',
  114. vod_name: it.name,
  115. vod_pic: '',
  116. vod_remarks: '',
  117. }
  118. });
  119. return JSON.stringify({
  120. list: videos,
  121. limit: 50,
  122. });
  123. }
  124. export function __jsEvalReturn() {
  125. return {
  126. init: init,
  127. home: home,
  128. homeVod: homeVod,
  129. category: category,
  130. detail: detail,
  131. play: play,
  132. search: search,
  133. };
  134. }