diff --git a/0827.json b/0827.json index 03e81c04..e8301d60 100644 --- a/0827.json +++ b/0827.json @@ -1,5 +1,5 @@ { - "spider": "./jar/custom_spider.jar;md5;e9ee25066054dee3891e754f566281b7", + "spider": "./jar/custom_spider.jar;md5;8f735b6bf0cda5984e8ec2c184fa9cd07", "wallpaper": "http://饭太硬.top/深色壁纸/api.php", "sites": [ { diff --git a/jar/custom_spider.jar b/jar/custom_spider.jar index 9f2107c2..5a070275 100644 Binary files a/jar/custom_spider.jar and b/jar/custom_spider.jar differ diff --git a/js/alist_open.js b/js/alist_open.js deleted file mode 100644 index 0cafedab..00000000 --- a/js/alist_open.js +++ /dev/null @@ -1,275 +0,0 @@ -import { _ } from './lib/cat.js'; -import { findBestLCS } from './lib/similarity.js'; - -const http = async function (url, options = {}) { - if (options.method == 'POST' && options.data) { - options.body = JSON.stringify(options.data); - options.headers = Object.assign({ 'content-type': 'application/json' }, options.headers); - } - const res = await req(url, options); - res.json = () => (res.content ? JSON.parse(res.content) : null); - res.text = () => res.content; - return res; -}; -['get', 'post'].forEach((method) => { - http[method] = function (url, options = {}) { - return http(url, Object.assign(options, { method: method.toUpperCase() })); - }; -}); - -const __drives = {}; -const __subtitle_cache = {}; - -async function get_drives_path(tid) { - const index = tid.indexOf('/', 1); - const name = tid.substring(1, index); - const path = tid.substring(index); - return { drives: await get_drives(name), path }; -} - -async function get_drives(name) { - const { settings, api, server } = __drives[name]; - if (settings.v3 == null) { - //获取 设置 - settings.v3 = false; - const data = (await http.get(server + '/api/public/settings')).json().data; - if (_.isArray(data)) { - settings.title = data.find((x) => x.key == 'title')?.value; - settings.v3 = false; - settings.version = data.find((x) => x.key == 'version')?.value; - settings.enableSearch = data.find((x) => x.key == 'enable search')?.value == 'true'; - } else { - settings.title = data.title; - settings.v3 = true; - settings.version = data.version; - settings.enableSearch = false; //v3 没有找到 搜索配置 - } - //不同版本 接口不一样 - api.path = settings.v3 ? '/api/fs/list' : '/api/public/path'; - api.file = settings.v3 ? '/api/fs/get' : '/api/public/path'; - api.search = settings.v3 ? '/api/public/search' : '/api/public/search'; - api.other = settings.v3 ? '/api/fs/other' : null; - } - return __drives[name]; -} - -let siteKey = ''; -let siteType = 0; - -function init(cfg) { - siteKey = cfg.skey; - siteType = cfg.stype; - cfg.ext.forEach( - (item) => - (__drives[item.name] = { - name: item.name, - server: item.server.endsWith('/') ? item.server.substring(0, item.server.length - 1) : item.server, - startPage: item.startPage || '/', //首页 - showAll: item.showAll === true, //默认只显示 视频和文件夹,如果想显示全部 showAll 设置true - params: item.params || {}, - _path_param: item.params - ? _.sortBy(Object.keys(item.params), function (x) { - return -x.length; - }) - : [], - settings: {}, - api: {}, - getParams(path) { - const key = this._path_param.find((x) => path.startsWith(x)); - return Object.assign({}, this.params[key], { path }); - }, - async getPath(path) { - const res = (await http.post(this.server + this.api.path, { data: this.getParams(path) })).json(); - return this.settings.v3 ? res.data.content : res.data.files; - }, - async getFile(path) { - const res = (await http.post(this.server + this.api.file, { data: this.getParams(path) })).json(); - const data = this.settings.v3 ? res.data : res.data.files[0]; - if (!this.settings.v3) data.raw_url = data.url; //v2 的url和v3不一样 - return data; - }, - async getOther(method, path) { - const data = this.getParams(path); - data.method = method; - const res = (await http.post(this.server + this.api.other, { data: data })).json(); - return res; - }, - isFolder(data) { - return data.type == 1; - }, - isVideo(data) { - //判断是否是 视频文件 - return this.settings.v3 ? data.type == 2 : data.type == 3; - }, - isSubtitle(data) { - if (data.type == 1) return false; - const ext = ['.srt', '.ass', '.scc', '.stl', '.ttml']; - return ext.some((x) => data.name.endsWith(x)); - }, - getType(data) { - const isVideo = this.isVideo(data); - return this.isFolder(data) ? 0 : isVideo ? 10 : 1; - }, - getPic(data) { - let pic = this.settings.v3 ? data.thumb : data.thumbnail; - return pic || (this.isFolder(data) ? 'http://img1.3png.com/281e284a670865a71d91515866552b5f172b.png' : ''); - }, - getSize(data) { - let sz = data.size || 0; - if (sz <= 0) return ''; - let filesize = ''; - if (sz > 1024 * 1024 * 1024 * 1024.0) { - sz /= 1024 * 1024 * 1024 * 1024.0; - filesize = 'TB'; - } else if (sz > 1024 * 1024 * 1024.0) { - sz /= 1024 * 1024 * 1024.0; - filesize = 'GB'; - } else if (sz > 1024 * 1024.0) { - sz /= 1024 * 1024.0; - filesize = 'MB'; - } else { - sz /= 1024.0; - filesize = 'KB'; - } - return sz.toFixed(2) + filesize; - }, - getRemark(data) { - return ''; - }, - }) - ); -} - -async function dir(dir, pg) { - for (const k in __subtitle_cache) { - delete __subtitle_cache[k]; - } - pg = pg || 1; - if (pg == 0) pg == 1; - if (dir === '/' || dir === '') { - const result = _.map(__drives, function (d) { - return { name: d.name, path: '/' + d.name + d.startPage, type: 0, thumb: '' }; - }); - return JSON.stringify({ - parent: '', - page: pg, - pagecount: pg, - list: result, - }); - } - - let { drives, path } = await get_drives_path(dir); - const id = dir.endsWith('/') ? dir : dir + '/'; - const list = await drives.getPath(path); - let subtList = []; - let videos = []; - let allList = []; - list.forEach((item) => { - if (drives.isSubtitle(item)) subtList.push(item.name); - const isVideo = drives.isVideo(item); - if (!drives.showAll && !drives.isFolder(item) && !isVideo) return; - const file = { - name: item.name.replaceAll('$', '_').replaceAll('#', '_'), - path: id + item.name + (drives.isFolder(item) ? '/' : ''), - thumb: drives.getPic(item), - type: drives.getType(item), - size: drives.getSize(item), - remark: drives.getRemark(item), - }; - if (drives.isVideo(item)) videos.push(file); - allList.push(file); - }); - if (subtList.length > 0) { - videos.forEach((item) => { - var sbust = findBestLCS(item.name, subtList); - if (sbust.bestMatch) __subtitle_cache[item.path] = [id + sbust.bestMatch.target]; - }); - } - return JSON.stringify({ - parent: id, - page: pg, - pagecount: pg, - list: allList, - }); -} - -async function file(file) { - let { drives, path } = await get_drives_path(file); - const item = await drives.getFile(path); - const subs = []; - if (__subtitle_cache[file]) { - for (const sub of __subtitle_cache[file]) { - try { - let subP = await get_drives_path(sub); - const subItem = await drives.getFile(subP.path); - subs.push(subItem.raw_url); - } catch (error) {} - } - } - if (item.provider === 'AliyundriveShare2Open' && drives.api.other) { - const urls = ['原画', item.raw_url]; - try { - const res = await drives.getOther('video_preview', path); - for (const live of res.data.video_preview_play_info.live_transcoding_task_list) { - if (live.status === 'finished') { - urls.push(live.template_id); - urls.push(live.url); - } - } - } catch (error) {} - const result = { - name: item.name, - url: urls, - size: drives.getSize(item), - remark: drives.getRemark(item), - header: {}, - extra: { - subt: subs, - }, - }; - return JSON.stringify(result); - } else if (item.provider === '123Pan') { - let url = item.raw_url; - try { - url = (await http.get(url)).json().data.redirect_url; - } catch (error) {} - const result = { - name: item.name, - url: url, - size: drives.getSize(item), - remark: drives.getRemark(item), - header: {}, - extra: { - subt: subs, - }, - }; - return JSON.stringify(result); - } else { - const result = { - name: item.name, - url: item.raw_url, - size: drives.getSize(item), - remark: drives.getRemark(item), - header: {}, - extra: { - subt: subs, - }, - }; - return JSON.stringify(result); - } -} - -function search(wd) { - return JSON.stringify({ - list: [], - }); -} - -export function __jsEvalReturn() { - return { - init: init, - dir: dir, - file: file, - search: search, - }; -} diff --git a/js/config_open.json b/js/config_open.json deleted file mode 100644 index 12146d9a..00000000 --- a/js/config_open.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "video": { - "sites": [ -{"key":"drpy_js_boosj_open","name":"童趣┃猫","type":3,"api":"assets://js/boosj_open.js"}, -{"key":"drpy_js_tuxiaobei_open","name":"兔小贝┃猫","type":3,"api":"assets://js/tuxiaobei_open.js"}, -{"key":"drpy_js_ubestkid_open","name":"贝乐虎┃猫","type":3,"api":"assets://js/ubestkid_open.js"}, -{"key":"drpy_js_dj0898_open","name":"世纪DJ┃猫","type":3,"api":"assets://js/dj0898_open.js"}, -{"key":"drpy_js_zxzj_open","name":"在线之家┃猫","type":3,"api":"assets://js/zxzj_open.js"}, -{"key":"drpy_js_cntv_open","name":"视聚场┃猫","type":3,"api":"assets://js/cntv_open.js"}, -{"key":"drpy_js_bili_open","name":"哔哩合集┃猫","type":3,"api":"assets://js/bili_open.js"}, - { - "key": "wogg", - "name": "Cat_open_js_玩偶|猫影视app", - "type": 3, - "api": "assets://js/wogg_open.js", - "ext": "8069d2ca50c749ed932e171fb2a41b95" - }, - - { - "key": "kunyu77", - "name": "Cat_open_js_鲲鱼|猫影视app", - "type": 3, - "api": "assets://js/kunyu77_open.js" - }, - { - "key": "czzy", - "name": "Cat_open_js_厂长|猫影视app", - "type": 3, - "api": "assets://js/czzy_open.js" - }, - { - "key": "libvio", - "name": "Cat_open_js_黎波|猫影视app", - "type": 3, - "api": "assets://js/libvio_open.js" - }, - { - "key": "kkys", - "name": "Cat_open_js_快看|猫影视app", - "type": 3, - "api": "assets://js/kkys_open.js" - }, - { - "key": "ikanbot", - "name": "Cat_open_js_爱看|猫影视app", - "type": 3, - "api": "assets://js/ikanbot_open.js" - }, - { - "key": "ngys", - "name": "Cat_open_js_南瓜|猫影视app", - "type": 3, - "api": "assets://js/ng_open.js" - }, - { - "key": "duboku", - "name": "Cat_open_js_独播库|猫影视app", - "type": 3, - "api": "assets://js/duboku_open.js" - }, - { - "key": "subaibai", - "name": "Cat_open_js_素白白|猫影视app", - "type": 3, - "api": "assets://js/subaibai_open.js" - }, - - { - "key": "sharenice", - "name": "Cat_open_js_短视频|猫影视app", - "type": 3, - "api": "assets://js/sharenice_open.js" - }, - { - "key": "mybili", - "name": "Cat_open_js_哔哩|猫影视app", - "type": 3, - "api": "assets://js/mybili_open.js" - }, - { - "key": "kuqimv", - "name": "Cat_open_js_酷奇|猫影视app", - "type": 3, - "api": "assets://js/kuqimv_open.js" - }, - { - "key": "230ts", - "name": "Cat_open_js_听书|猫影视app", - "type": 3, - "api": "assets://js/230ts_open.js" - } - - ] - }, - "pan": { - "sites": [ - { - "key": "alist", - "name": "Alist", - "type": 40, - "api": "assets://js/alist_open.js", - "ext": [ - { - "name": "🙋丫仙女", - "server": "http://alist.xiaoya.pro/", - "startPage": "/", - "showAll": false, - "search": true, - "headers": { - "Authorization": "" - }, - "params": { - "/abc": { - "password": "123" - }, - "/abc/abc": { - "password": "123" - } - } - }, - { - "name": "🐋一只鱼", - "server": "https://alist.youte.ml" - }, - { - "name": "杜比", - "server": "https://dubi.tk" - }, - { - "name": "资源", - "server": "https://pan.ecve.cn" - }, - { - "name": "🌊七米蓝", - "server": "https://al.chirmyram.com" - }, - { - "name": "🐉神族九帝", - "server": "https://alist.shenzjd.com" - }, - { - "name": "☃️姬路白雪", - "server": "https://pan.jlbx.xyz" - }, - { - "name": "✨星梦", - "server": "https://pan.bashroot.top" - }, - { - "name": "💢repl", - "server": "https://ali.liucn.repl.co" - }, - { - "name": "💦讯维云盘", - "server": "https://pan.xwbeta.com" - } - ] - } - ] - } -} \ No newline at end of file