From 1aa73d0f9b0afb4511c1be7810d7dafc4268cd4d Mon Sep 17 00:00:00 2001 From: ted423 Date: Tue, 7 Jan 2025 22:38:18 +0800 Subject: [PATCH] =?UTF-8?q?sitedown:=20cnlang=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/sites/cnlang.org/config.json | 102 -------------- .../cnlang.org/getUserSeedingTorrents.js | 126 ------------------ 2 files changed, 228 deletions(-) delete mode 100644 resource/sites/cnlang.org/config.json delete mode 100644 resource/sites/cnlang.org/getUserSeedingTorrents.js diff --git a/resource/sites/cnlang.org/config.json b/resource/sites/cnlang.org/config.json deleted file mode 100644 index b13fca8b9..000000000 --- a/resource/sites/cnlang.org/config.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "name": "国语视界", - "timezoneOffset": "+0800", - "schema": "Discuz", - "supportedFeatures": { - "search": false, - "imdbSearch": false, - "sendTorrent": false - }, - "url": "https://cnlang.org/", - "description": "国语视界音轨组,特效字幕组官方首发论坛,国语音轨和特效字幕的分享基地,蓝光DIY和4K电影爱好者的乐园。", - "icon": "https://cnlang.org/favicon.ico", - "tags": ["特效字幕", "国语音轨"], - "collaborator": [ - "fzlins" - ], - "host": "cnlang.org", - "selectors": { - "userBaseInfo": { - "page": "/home.php?mod=spacecp&ac=credit", - "fields": { - "id": { - "selector": [".vwmy a"], - "attribute": "href", - "filters": ["query ? query.replace(/\\D+/g, '') : '' "] - }, - "name": { - "selector": [".vwmy a"] - }, - "messageCount": { - "selector": ["a.a.showmenu.new"], - "filters": ["query.text().match(/(\\d+)/)", "(query && query.length>=2)?parseInt(query[1]):0"] - }, - "isLogged": { - "selector": [ - "a[href*='action=logout']" - ], - "filters": [ - "query.length>0" - ] - }, - "bonus": { - "selector": "li:contains('大洋')", - "filters": [ - "query.text().match(/大洋.*?([\\d.]+)/)[1]", - "parseFloat(query)" - ] - } - } - }, - "userExtendInfo": { - "page": "/home.php?mod=spacecp&ac=plugin&id=bt_magnet:action", - "fields": { - "uploaded": { - "selector": ".attach_magnet_div p:contains('上传量')", - "filters": [ - "query.text().replace('上传量:', '').trim().sizeToNumber()" - ] - }, - "downloaded": { - "selector": ".attach_magnet_div p:contains('下载量')", - "filters": [ - "query.text().replace('下载量:', '').trim().sizeToNumber()" - ] - }, - "ratio": { - "selector": ".attach_magnet_div p:contains('分享率:')", - "filters": [ - "query.text().replace('分享率:', '').replace(/,/g,'').trim()", - "parseFloat(query)" - ] - }, - "levelName": { - "selector": ["a[href='home.php?mod=spacecp&ac=usergroup']:first"], - "filters": ["query.text().replace('用户组: ', '').trim()"] - }, - "joinTime": { - "selector": ".attach_magnet_div p:contains('加入时间:')", - "filters": [ - "query.text().replace('加入时间:', '').trim()", - "dateTime(query).isValid()?dateTime(query).valueOf():query" - ] - } - } - }, - "userSeedingTorrents": { - "prerequisites": "!user.seeding", - "page": "/home.php?mod=spacecp&ac=plugin&id=bt_magnet:action&subop=seeding", - "parser": "getUserSeedingTorrents.js", - "fields": { - "seeding": { - "selector": [".mn tr:not(:eq(0))"], - "filters": ["query.length"] - }, - "seedingSize": { - "selector": [".mn tr:not(:eq(0))"], - "filters": ["jQuery.map(query.find('td:eq(1)'), (item)=>{return $(item).text();})", "_self.getTotalSize(query)"] - } - } - } - } - } \ No newline at end of file diff --git a/resource/sites/cnlang.org/getUserSeedingTorrents.js b/resource/sites/cnlang.org/getUserSeedingTorrents.js deleted file mode 100644 index 5f758d663..000000000 --- a/resource/sites/cnlang.org/getUserSeedingTorrents.js +++ /dev/null @@ -1,126 +0,0 @@ -if ("".getQueryString === undefined) { - String.prototype.getQueryString = function(name, split) { - if (split == undefined) split = "&"; - var reg = new RegExp( - "(^|" + split + "|\\?)" + name + "=([^" + split + "]*)(" + split + "|$)" - ), - r; - if ((r = this.match(reg))) return decodeURI(r[2]); - return null; - }; -} - -(function(options, User) { - class Parser { - constructor(options, dataURL) { - this.options = options; - this.dataURL = dataURL; - this.body = null; - this.rawData = ""; - this.pageInfo = { - count: 0, - current: 1 - }; - this.result = { - seeding: 0, - seedingSize: 0 - }; - this.load(); - } - - /** - * 完成 - */ - done() { - this.options.resolve(this.result); - } - - /** - * 解析内容 - */ - parse() { - const doc = new DOMParser().parseFromString(this.rawData, "text/html"); - // 构造 jQuery 对象 - this.body = $(doc).find("body"); - - this.getPageInfo(); - - let results = new User.InfoParser(User.service).getResult( - this.body, - this.options.rule - ); - - if (results) { - this.result.seeding += results.seeding; - this.result.seedingSize += results.seedingSize; - } - - // 是否已到最后一页 - if (this.pageInfo.current < this.pageInfo.count) { - this.pageInfo.current++; - this.load(); - } else { - this.done(); - } - } - - /** - * 获取页面相关内容 - */ - getPageInfo() { - if (this.pageInfo.count > 0) { - return; - } - // 获取最大页码 - const infos = this.body - .find("input[name='custompage']") - .attr("size"); - if (infos) { - this.pageInfo.count = parseInt(infos); - } else { - this.pageInfo.count = 1; - } - } - - /** - * 加载当前页内容 - */ - load() { - let url = this.dataURL; - if (this.pageInfo.current > 0) { - url += "&page=" + this.pageInfo.current; - } - $.get(url) - .done(result => { - this.rawData = result; - this.parse(); - }) - .fail(() => { - this.done(); - }); - } - } - - let dataURL = options.site.activeURL + options.rule.page; - dataURL = dataURL - .replace("$user.id$", options.userInfo.id) - .replace("$user.name$", options.userInfo.name) - .replace("://", "****") - .replace(/\/\//g, "/") - .replace("****", "://"); - - new Parser(options, dataURL); -})(_options, _self); -/** - * - _options 表示当前参数 - { - site, - rule, - userInfo, - resolve, - reject - } - - _self 表示 User(/src/background/user.ts) 类实例 - */ \ No newline at end of file