From 6336d7a6322deac94feba7dd91248cef31dedf7a Mon Sep 17 00:00:00 2001 From: dongchenys <14018478+dongchenys@user.noreply.gitee.com> Date: Mon, 11 Mar 2024 15:03:51 +0000 Subject: [PATCH] 1 Signed-off-by: dongchenys <14018478+dongchenys@user.noreply.gitee.com> --- js/iktv.js | 145 ++++++++++++++++++++++++++ js/yinyuetai.js | 264 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 409 insertions(+) create mode 100644 js/iktv.js create mode 100644 js/yinyuetai.js diff --git a/js/iktv.js b/js/iktv.js new file mode 100644 index 0000000..c28ba53 --- /dev/null +++ b/js/iktv.js @@ -0,0 +1,145 @@ +import { Crypto, load, _ } from 'assets://js/lib/cat.js'; + +let key = 'ktv'; +let HOST = 'http://vpsdn.leuse.top/searchmv'; +let mktvUrl = 'http://txysong.mysoto.cc/songs/'; +let host = ''; +let siteKey = ''; +let siteType = 0; + +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'; + +async function request(reqUrl, extHeader) { + let headers = { + 'User-Agent': MOBILE_UA, + 'Referer': host, + }; + const res = await req(reqUrl, { + method: 'get', + headers: headers, + }); + return res.content; +} + +// cfg = {skey: siteKey, ext: extend} +async function init(cfg) { + siteKey = cfg.skey; + siteType = cfg.stype; +} + +async function home(filter) { + let classes = [{ + type_id: 1, + type_name: '歌手', + },{ + type_id: 2, + type_name: '曲库', + }]; + const filterObj = { + 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: '组合' }] }], + 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: '影视' }] }], + }; + return JSON.stringify({ + class: classes, + filters: filterObj, + }); +} + +async function homeVod() { +} + +async function category(tid, pg, filter, extend) { + if (pg <= 0 || typeof (pg) == 'undefined') pg = 1; + let url = HOST; + let videos = []; + if(tid == 1) { + url = url + `?table=singer&pg=${pg}`; + if(extend['region']) url = url + '&where=region_id&keywords=' + extend['region']; + if(extend['form']) url += '&where=form_id&keywords=' + extend['form']; + console.log(url); + let res = JSON.parse(await request(url)); + videos = _.map(res, item => { + return { + vod_id: item.name, + vod_name: item.name, + vod_pic: mktvUrl + item.id + '.jpg', + vod_remarks: '', + } + }); + } else if(tid == 2) { + url = url + `?table=song&pg=${pg}`; + if(extend['lan']) url = url + '&where=language_id&keywords=' + extend['lan']; + if(extend['type']) url += '&where=type_id&keywords=' + extend['type']; + let res = JSON.parse(await request(url)); + videos = _.map(res, item => { + return { + vod_id: mktvUrl + item.number + '.mkv', + vod_name: item.name, + vod_pic: '', + vod_remarks: '', + } + }); + } + return JSON.stringify({ + list: videos, + page: pg, + limit: 20, + total: videos.length + }); +} + +async function detail(id) { + const vod = { + vod_id: id, + vod_name: id, + vod_play_from: 'Leospring', + vod_content: '关注公众号“东方精英汇”,获取最新接口,加qq群783264601防迷失!【东辰影视】提醒您:该资源来源于网络,请勿传播,仅供技术学习使用,请在学习后24小时内删除!', + } + if (id.endsWith('.mkv')) { + vod.vod_play_url = '播放$' + id; + } else { + let url = HOST + '?table=song&where=singer_names&keywords=' + id + '&size=999'; + let res = JSON.parse(await request(url)); + vod.vod_play_url = (_.map(res, item => { + return item.name + '$' + mktvUrl + item.number + '.mkv'; + })).join('#'); + } + return JSON.stringify({ + list: [vod], + }); +} + +async function play(flag, id, flags) { + return JSON.stringify({ + parse: 0, + url: id, + }); +} + +async function search(wd, quick) { + let data = JSON.parse(await request(HOST + '?keywords=' + wd)); + let videos = _.map(data, (it) => { + return { + vod_id: mktvUrl + it.number + '.mkv', + vod_name: it.name, + vod_pic: '', + vod_remarks: '', + } + }); + return JSON.stringify({ + list: videos, + limit: 50, + }); +} + +export function __jsEvalReturn() { + return { + init: init, + home: home, + homeVod: homeVod, + category: category, + detail: detail, + play: play, + search: search, + }; +} \ No newline at end of file diff --git a/js/yinyuetai.js b/js/yinyuetai.js new file mode 100644 index 0000000..1f35136 --- /dev/null +++ b/js/yinyuetai.js @@ -0,0 +1,264 @@ +import { Crypto, load, _ } from './lib/cat.js'; + +let siteKey = ''; +let siteType = 0; +let headers = { + 'Vi': '1.0.0;11;101', + 'Wua': 'YYT/1.0.0 (WEB;web;11;zh-CN;OUN7HHDoKgoDlMN3Z2oQH)', +}; +async function request(reqUrl, postData, get) { + let res = await req(reqUrl, { + method: get ? 'get' : 'post', + headers: headers, + data: postData || {}, + }); + let content = res.content; + return content; +} + +async function init(cfg) { + siteKey = cfg.skey; + siteType = cfg.stype; +} + +async function home(filter) { + let st = Math.floor(Date.now() / 1e3); + let pp = Ea('st' + st); + let url ='https://video-api.yinyuetai.com/video/explore/channels'; + let res = JSON.parse((await req(url, { + 'method': 'get', + 'headers': { + 'Vi': '1.0.0;11;101', + 'Wua': 'YYT/1.0.0 (WEB;web;11;zh-CN;OUN7HHDoKgoDlMN3Z2oQH)', + 'St': st, + 'Pp': pp + } + })).content); + //console.log(res); + const classes = _.map(res.data, n => { + return { + type_id: n.id, + type_name: n.channelName, + } + }); + + return JSON.stringify({ + class: classes, + }); +} + +async function homeVod() { + +} + +async function category(tid, pg, filter, extend) { + if(!pg || pg <=0) pg = 1; + `https://video-api.yinyuetai.com/video/explore/channelVideos?channelId=${tid}&detailType=2&size=20&offset=${20 * (pg-1)}` + let url = `https://video-api.yinyuetai.com/video/explore/channelVideos?channelId=${tid}&detailType=2&size=20&offset=${20 * (pg-1)}`; + let st = Math.floor(Date.now() / 1e3); + let d = `channelId${tid}detailType2offset${20 * (pg-1)}size20st${st}` + //console.log(d); + let pp = Ea(d); + let res = JSON.parse((await req(url, { + 'method': 'get', + 'headers': { + 'Vi': '1.0.0;11;101', + 'Wua': 'YYT/1.0.0 (WEB;web;11;zh-CN;OUN7HHDoKgoDlMN3Z2oQH)', + 'St': st, + 'Pp': pp + } + })).content); + let videos = _.map(res.data, n => { + return { + vod_id: n.fullClip.videoId, + vod_name: n.title, + vod_pic: n.headImg, + } + }); + return JSON.stringify({ + list: videos, + page: pg, + limit: 20, + }); +} + +async function detail(id) { + let url = 'https://video-api.yinyuetai.com/video/get?id=' + id; + try { + let res = JSON.parse((await req(url, { + 'method': 'get', + })).content).data; + let vod = { + vod_id: id, + vod_name: res.title, + vod_play_from: _.map(res.fullClip.urls, n => {return n.display}).join('$$$'), + vod_play_url: _.map(res.fullClip.urls, n => {return '播放$' + n.url}).join('$$$'), + vod_content: '关注公众号“东方精英汇”,获取最新接口,加qq群783264601防迷失!【东辰影视】提醒您:该资源来源于网络,请勿传播,仅供技术学习使用,请在学习后24小时内删除!', + }; + return JSON.stringify({ + list: [vod], + }); + } catch (e) { + console.log('err', e); + } + return null; +} + +async function search(wd, quick, pg) { + let url = 'https://search-api.yinyuetai.com/search/get_search_result.json'; + let params = { + searchType: 'MV', + key: wd, + sinceId: 0, + size: 20, + requestTagRows: [], + } + let res = JSON.parse((await req(url, { + 'method': 'post', + 'headers': { + 'Content-Type':'application/json' + }, + 'data': params, + })).content); + let videos = _.map(res.data, n => { + return { + vod_id: n.fullClip.videoId, + vod_name: n.title, + vod_pic: n.headImg, + } + }); + + return JSON.stringify({ + list: videos, + }); +} + +async function play(flag, id, flags) { + return JSON.stringify({ + parse: 0, + url: id + }); +} + +function base64Encode(text) { + return Crypto.enc.Base64.stringify(Crypto.enc.Utf8.parse(text)); +} + +function base64Decode(text) { + return Crypto.enc.Utf8.stringify(Crypto.enc.Base64.parse(text)); +} + +function base64ToHex(str) { + for (var i = 0, + bin = base64Decode(str.replace(/[ \r\n]+$/, "")), hex = []; i < bin.length; ++i) { + var tmp = bin.charCodeAt(i).toString(16); + if (tmp.length === 1) tmp = "0" + tmp; + hex[hex.length] = tmp; + } + return hex.join(""); +} + +function Ea(e) { + const t = e + "91fd6ee712437d42eeccdf545133039888d1cc77"; + return o(t); +} + +function o(a, i) { + var s = wordsToBytes(n(a)); + return i && i.asBytes ? s : i && i.asString ? bytesToString(s) : bytesToHex(s) +}; + +function n(a) { + a = stringToBytes(a); + var i = bytesToWords(a) + , s = a.length * 8 + , l = [] + , c = 1732584193 + , u = -271733879 + , p = -1732584194 + , f = 271733878 + , d = -1009589776; + i[s >> 5] |= 128 << 24 - s % 32, + i[(s + 64 >>> 9 << 4) + 15] = s; + for (var v = 0; v < i.length; v += 16) { + for (var y = c, S = u, g = p, C = f, A = d, w = 0; w < 80; w++) { + if (w < 16) + l[w] = i[v + w]; + else { + var T = l[w - 3] ^ l[w - 8] ^ l[w - 14] ^ l[w - 16]; + l[w] = T << 1 | T >>> 31 + } + var U = (c << 5 | c >>> 27) + d + (l[w] >>> 0) + (w < 20 ? (u & p | ~u & f) + 1518500249 : w < 40 ? (u ^ p ^ f) + 1859775393 : w < 60 ? (u & p | u & f | p & f) - 1894007588 : (u ^ p ^ f) - 899497514); + d = f, + f = p, + p = u << 30 | u >>> 2, + u = c, + c = U + } + c += y, + u += S, + p += g, + f += C, + d += A + } + return [c, u, p, f, d] +} + +function stringToBytes(e) { + for (var t = [], r = 0; r < e.length; r++) + t.push(e.charCodeAt(r) & 255); + return t +} + +function bytesToString(e) { + for (var t = [], r = 0; r < e.length; r++) + t.push(String.fromCharCode(e[r])); + return t.join("") +} + +function bytesToWords(r) { + for (var n = [], o = 0, a = 0; o < r.length; o++, + a += 8) + n[a >>> 5] |= r[o] << 24 - a % 32; + return n +} +function wordsToBytes(r) { + for (var n = [], o = 0; o < r.length * 32; o += 8) + n.push(r[o >>> 5] >>> 24 - o % 32 & 255); + return n +} +function bytesToHex(r) { + for (var n = [], o = 0; o < r.length; o++) + n.push((r[o] >>> 4).toString(16)), + n.push((r[o] & 15).toString(16)); + return n.join("") +} +function hexToBytes(r) { + for (var n = [], o = 0; o < r.length; o += 2) + n.push(parseInt(r.substr(o, 2), 16)); + return n +} +function bytesToBase64(r) { + for (var n = [], o = 0; o < r.length; o += 3) + for (var a = r[o] << 16 | r[o + 1] << 8 | r[o + 2], i = 0; i < 4; i++) + o * 8 + i * 6 <= r.length * 8 ? n.push(e.charAt(a >>> 6 * (3 - i) & 63)) : n.push("="); + return n.join("") +} +function base64ToBytes(r) { + r = r.replace(/[^A-Z0-9+\/]/ig, ""); + for (var n = [], o = 0, a = 0; o < r.length; a = ++o % 4) + a != 0 && n.push((e.indexOf(r.charAt(o - 1)) & Math.pow(2, -2 * a + 8) - 1) << a * 2 | e.indexOf(r.charAt(o)) >>> 6 - a * 2); + return n +} + +export function __jsEvalReturn() { + return { + init: init, + home: home, + homeVod: homeVod, + category: category, + detail: detail, + play: play, + search: search, + }; +} \ No newline at end of file