diff --git a/resource/schemas/NexusPHP/getSearchResult.js b/resource/schemas/NexusPHP/getSearchResult.js index 099e50757..282e684b2 100644 --- a/resource/schemas/NexusPHP/getSearchResult.js +++ b/resource/schemas/NexusPHP/getSearchResult.js @@ -1,481 +1,481 @@ -/** - * NexusPHP 默认搜索结果解析类 - */ -(function (options, Searcher) { - class Parser { - constructor() { - this.haveData = false; - if (/takelogin\.php|
tbody > tr", ""); - let table = options.page.find(selector); - // 获取种子列表行 - let rows = table.find("> tbody > tr"); - if (rows.length == 0) { - options.status = ESearchResultParseStatus.torrentTableIsEmpty; //`[${options.site.name}]没有定位到种子列表,或没有相关的种子`; - return []; - } - let results = []; - // 获取表头 - let header = table.find("> thead > tr > th"); - let beginRowIndex = 0; - if (header.length == 0) { - beginRowIndex = 1; - header = rows.eq(0).find("th,td"); - } - - // 用于定位每个字段所列的位置 - let fieldIndex = { - // 发布时间 - time: -1, - // 大小 - size: -1, - // 上传数量 - seeders: -1, - // 下载数量 - leechers: -1, - // 完成数量 - completed: -1, - // 评论数量 - comments: -1, - // 发布人 - author: header.length - 1, - // 分类 - category: -1 - }; - - if (site.url.lastIndexOf("/") != site.url.length - 1) { - site.url += "/"; - } - - // 获取字段所在的列 - for (let index = 0; index < header.length; index++) { - let cell = header.eq(index); - let text = cell.text(); - - // 评论数 - if (cell.find("img.comments").length) { - fieldIndex.comments = index; - fieldIndex.author = - index == fieldIndex.author ? -1 : fieldIndex.author; - continue; - } - - // 发布时间 - if (cell.find("img.time").length) { - fieldIndex.time = index; - fieldIndex.author = - index == fieldIndex.author ? -1 : fieldIndex.author; - continue; - } - - // 大小 - if (cell.find("img.size").length) { - fieldIndex.size = index; - fieldIndex.author = - index == fieldIndex.author ? -1 : fieldIndex.author; - continue; - } - - // 种子数 - if (cell.find("img.seeders").length) { - fieldIndex.seeders = index; - fieldIndex.author = - index == fieldIndex.author ? -1 : fieldIndex.author; - continue; - } - - // 下载数 - if (cell.find("img.leechers").length) { - fieldIndex.leechers = index; - fieldIndex.author = - index == fieldIndex.author ? -1 : fieldIndex.author; - continue; - } - - // 完成数 - if (cell.find("img.snatched").length) { - fieldIndex.completed = index; - fieldIndex.author = - index == fieldIndex.author ? -1 : fieldIndex.author; - continue; - } - - // 分类 - if (/(cat|类型|類型|分类|分類|Тип)/gi.test(text)) { - fieldIndex.category = index; - fieldIndex.author = - index == fieldIndex.author ? -1 : fieldIndex.author; - continue; - } - } - - if (options.entry.fieldIndex) { - fieldIndex = Object.assign(fieldIndex, options.entry.fieldIndex); - } - - try { - // 遍历数据行 - for (let index = beginRowIndex; index < rows.length; index++) { - const row = rows.eq(index); - - // FIX https://github.com/ronggang/PT-Plugin-Plus/issues/347 - row.attr('id') === 'zhiding' && row.removeAttr('id'); - - let cells = row.find(">td"); - - let title = this.getTitle(row); - - // 没有获取标题时,继续下一个 - if (title.length == 0) { - continue; - } - let link = title.attr("href"); - if (link && link.substr(0, 2) === "//") { - // 适配HUDBT、WHU这样以相对链接开头 - link = `${site_url_help.protocol}://${link}`; - } else if (link && link.substr(0, 4) !== "http") { - link = `${site.url}${link}`; - } - - // 获取下载链接 - let url = this.getDownloadLink(row,link); - if (url && url.substr(0, 2) === "//") { - // 适配HUDBT、WHU这样以相对链接开头 - url = `${site_url_help.protocol}://${url}`; - } else if (url && url.substr(0, 4) !== "http") { - url = `${site.url}${url}`; - } - - if (!url) { - continue; - } - - url = url + - (site && site.passkey ? "&passkey=" + site.passkey : ""); - - let data = { - title: title.attr("title") || title.text(), - subTitle: this.getSubTitle(title, row), - link, - url, - size: this.getFieldValue(row, cells, fieldIndex, "size") || 0, - time: - fieldIndex.time == -1 - ? "" - : this.getTime(cells.eq(fieldIndex.time)), - author: this.getFieldValue(row, cells, fieldIndex, "author") || "", - seeders: this.getFieldValue(row, cells, fieldIndex, "seeders") || 0, - leechers: - this.getFieldValue(row, cells, fieldIndex, "leechers") || 0, - completed: - this.getFieldValue(row, cells, fieldIndex, "completed") || 0, - comments: - this.getFieldValue(row, cells, fieldIndex, "comments") || 0, - site: site, - tags: Searcher.getRowTags(this.site, row), - entryName: options.entry.name, - category: - fieldIndex.category == -1 - ? null - : this.getFieldValue(row, cells, fieldIndex, "category") || - this.getCategory(cells.eq(fieldIndex.category)), - progress: Searcher.getFieldValue(site, row, "progress"), - status: Searcher.getFieldValue(site, row, "status") - }; - - results.push(data); - } - } catch (error) { - options.status = ESearchResultParseStatus.parseError; - options.errorMsg = error.stack; - //`[${options.site.name}]获取种子信息出错: ${error.stack}`; - } - - return results; - } - - /** - * 获取指定字段内容 - * @param {*} row - * @param {*} cells - * @param {*} fieldIndex - * @param {*} fieldName - */ - getFieldValue(row, cells, fieldIndex, fieldName, returnCell) { - let parent = row; - let cell = null; - if ( - cells && - fieldIndex && - fieldIndex[fieldName] !== undefined && - fieldIndex[fieldName] !== -1 - ) { - cell = cells.eq(fieldIndex[fieldName]); - parent = cell || row; - } - - let result = Searcher.getFieldValue(this.site, parent, fieldName); - - if (!result && cell) { - if (returnCell) { - return cell; - } - result = cell.text(); - } - - return result; - } - - /** - * 获取时间 - * @param {*} cell - */ - getTime(cell) { - let time = cell.find("span[title],time[title]").attr("title"); - if (!time) { - time = $("") - .html(cell.html().replace("
", " ")) - .text(); - } - if (options.site.host === "pt.sjtu.edu.cn") { - if (time.match(/\d+[分时天月年]/g)) { - time = Date.now() - this._parseTime(time) - time = new Date(time).toLocaleString("zh-CN", {hour12: false}).replace(/\//g, '-') - } - } - return time || ""; - } - - _parseTime(timeString) { - const timeMatch = timeString.match(/\d+[分时天月年]/g) - let length = 0 - timeMatch.forEach(time => { - const timeMatch = time.match(/(\d+)([分时天月年])/) - const number = parseInt(timeMatch[1]) - const unit = timeMatch[2] - switch (true) { - case unit === '分': - length += number - break - case unit === '时': - length += number * 60 - break - case unit === '天': - length += number * 60 * 24 - break - case unit === '月': - length += number * 60 * 24 * 30 - break - case unit === '年': - length += number * 60 * 24 * 365 - break - default: - } - }) - return length * 60 * 1000 - } - - /** - * 获取标题 - */ - getTitle(row) { - let title = - Searcher.getFieldValue(this.site, row, "title") || - row.find("a[href*='hit'][title]").first(); - - if (typeof title === "string") { - return title; - } - - if (title.length == 0) { - title = row.find("a[href*='hit']:has(b)").first(); - } - - if (title.length == 0) { - // 特殊情况处理 - switch (options.site.host) { - case "u2.dmhy.org": - title = row.find("a.tooltip[href*='hit']").first(); - break; - } - } - - // 对title进行处理,防止出现cf的email protect - let cfemail = title.find("span.__cf_email__"); - if (cfemail.length > 0) { - cfemail.each((index, el) => { - $(el).replaceWith(Searcher.cfDecodeEmail($(el).data("cfemail"))); - }); - } - - return title; - } - - /** - * 获取副标题 - * @param {*} title - * @param {*} row - */ - getSubTitle(title, row) { - let subTitle = Searcher.getFieldValue(this.site, row, "subTitle"); - if (subTitle) { - return subTitle; - } - - try { - subTitle = title - .parent() - .html() - .split("
"); - if (subTitle && subTitle.length > 1) { - subTitle = $("") - .html(subTitle[subTitle.length - 1]) - .text(); - } else { - // 特殊情况处理 - switch (options.site.host) { - case "hdchina.org": - if ( - title - .parent() - .next() - .is("h4") - ) { - subTitle = title - .parent() - .next() - .text(); - } - break; - - case "tp.m-team.cc": - case "pt.m-team.cc": - case "kp.m-team.cc": - title = row.find("a[href*='hit'][title]").last(); - subTitle = title - .parent() - .html() - .split("
"); - subTitle = $("") - .html(subTitle[subTitle.length - 1]) - .text(); - break; - - case "u2.dmhy.org": - subTitle = $(".torrentname > tbody > tr:eq(1)", row) - .find(".tooltip") - .text(); - break; - - case "whu.pt": - case "hudbt.hust.edu.cn": - subTitle = $("h3", row).text(); - break; - - default: - subTitle = ""; - break; - } - } - - return subTitle || ""; - } catch (error) { - return ""; - } - } - - // 很 - getDownloadLink(row, link) { - let url; - switch (options.site.host) { - case 'hdsky.me': { - let url_another = row.find('form[action*="download.php"]:eq(0)') - if (url_another.length > 0) { - url = url_another.attr('action') - break; - } - - } - - default: { - let url_another = row.find("img.download").parent(); - - if (url_another.length) { - if (url_another.get(0).tagName !== "A") { - let id = link.getQueryString("id"); - url = `download.php?id=${id}`; - } else { - url = url_another.attr("href"); - } - } else { - let id = link.getQueryString("id"); - url = `download.php?id=${id}`; - } - url = url + "&https=1" - } - } - - return url; - } - - /** - * 获取分类 - * @param {*} cell 当前列 - */ - getCategory(cell) { - let result = { - name: "", - link: "" - }; - let link = cell.find("a:first"); - let img = link.find("img:first"); - - if (link.length) { - result.link = link.attr("href"); - if (result.link.substr(0, 4) !== "http") { - result.link = options.site.url + result.link; - } - } - - if (img.length) { - result.name = img.attr("title") || img.attr("alt"); - } else { - result.name = link.text(); - } - return result; - } - } - - let parser = new Parser(options); - options.results = parser.getResult(); - console.log(options.results); -})(options, options.searcher); +/** + * NexusPHP 默认搜索结果解析类 + */ +(function (options, Searcher) { + class Parser { + constructor() { + this.haveData = false; + if (/takelogin\.php| tbody > tr", ""); + let table = options.page.find(selector); + // 获取种子列表行 + let rows = table.find("> tbody > tr"); + if (rows.length == 0) { + options.status = ESearchResultParseStatus.torrentTableIsEmpty; //`[${options.site.name}]没有定位到种子列表,或没有相关的种子`; + return []; + } + let results = []; + // 获取表头 + let header = table.find("> thead > tr > th"); + let beginRowIndex = 0; + if (header.length == 0) { + beginRowIndex = 1; + header = rows.eq(0).find("th,td"); + } + + // 用于定位每个字段所列的位置 + let fieldIndex = { + // 发布时间 + time: -1, + // 大小 + size: -1, + // 上传数量 + seeders: -1, + // 下载数量 + leechers: -1, + // 完成数量 + completed: -1, + // 评论数量 + comments: -1, + // 发布人 + author: header.length - 1, + // 分类 + category: -1 + }; + + if (site.url.lastIndexOf("/") != site.url.length - 1) { + site.url += "/"; + } + + // 获取字段所在的列 + for (let index = 0; index < header.length; index++) { + let cell = header.eq(index); + let text = cell.text(); + + // 评论数 + if (cell.find(".comments").length) { + fieldIndex.comments = index; + fieldIndex.author = + index == fieldIndex.author ? -1 : fieldIndex.author; + continue; + } + + // 发布时间 + if (cell.find("img.time,div.date").length) { + fieldIndex.time = index; + fieldIndex.author = + index == fieldIndex.author ? -1 : fieldIndex.author; + continue; + } + + // 大小 + if (cell.find("img.size,div[alt='size']").length) { + fieldIndex.size = index; + fieldIndex.author = + index == fieldIndex.author ? -1 : fieldIndex.author; + continue; + } + + // 种子数 + if (cell.find("img.seeders,div[alt='seeders']").length) { + fieldIndex.seeders = index; + fieldIndex.author = + index == fieldIndex.author ? -1 : fieldIndex.author; + continue; + } + + // 下载数 + if (cell.find("img.leechers,div[alt='leechers']").length) { + fieldIndex.leechers = index; + fieldIndex.author = + index == fieldIndex.author ? -1 : fieldIndex.author; + continue; + } + + // 完成数 + if (cell.find("img.snatched,div[alt='snatched']").length) { + fieldIndex.completed = index; + fieldIndex.author = + index == fieldIndex.author ? -1 : fieldIndex.author; + continue; + } + + // 分类 + if (/(cat|类型|類型|分类|分類|Тип)/gi.test(text)) { + fieldIndex.category = index; + fieldIndex.author = + index == fieldIndex.author ? -1 : fieldIndex.author; + continue; + } + } + + if (options.entry.fieldIndex) { + fieldIndex = Object.assign(fieldIndex, options.entry.fieldIndex); + } + + try { + // 遍历数据行 + for (let index = beginRowIndex; index < rows.length; index++) { + const row = rows.eq(index); + + // FIX https://github.com/ronggang/PT-Plugin-Plus/issues/347 + row.attr('id') === 'zhiding' && row.removeAttr('id'); + + let cells = row.find(">td"); + + let title = this.getTitle(row,cells,fieldIndex); + + // 没有获取标题时,继续下一个 + if (title.length == 0) { + continue; + } + let link = title.attr("href"); + if (link && link.substr(0, 2) === "//") { + // 适配HUDBT、WHU这样以相对链接开头 + link = `${site_url_help.protocol}://${link}`; + } else if (link && link.substr(0, 4) !== "http") { + link = `${site.url}${link}`; + } + + // 获取下载链接 + let url = this.getDownloadLink(row,link); + if (url && url.substr(0, 2) === "//") { + // 适配HUDBT、WHU这样以相对链接开头 + url = `${site_url_help.protocol}://${url}`; + } else if (url && url.substr(0, 4) !== "http") { + url = `${site.url}${url}`; + } + + if (!url) { + continue; + } + + url = url + + (site && site.passkey ? "&passkey=" + site.passkey : ""); + + let data = { + title: title.attr("title") || title.text(), + subTitle: this.getSubTitle(title, row), + link, + url, + size: this.getFieldValue(row, cells, fieldIndex, "size") || 0, + time: + fieldIndex.time == -1 + ? "" + : this.getTime(cells.eq(fieldIndex.time)), + author: this.getFieldValue(row, cells, fieldIndex, "author") || "", + seeders: this.getFieldValue(row, cells, fieldIndex, "seeders") || 0, + leechers: + this.getFieldValue(row, cells, fieldIndex, "leechers") || 0, + completed: + this.getFieldValue(row, cells, fieldIndex, "completed") || 0, + comments: + this.getFieldValue(row, cells, fieldIndex, "comments") || 0, + site: site, + tags: Searcher.getRowTags(this.site, row), + entryName: options.entry.name, + category: + fieldIndex.category == -1 + ? null + : this.getFieldValue(row, cells, fieldIndex, "category") || + this.getCategory(cells.eq(fieldIndex.category)), + progress: Searcher.getFieldValue(site, row, "progress"), + status: Searcher.getFieldValue(site, row, "status") + }; + + results.push(data); + } + } catch (error) { + options.status = ESearchResultParseStatus.parseError; + options.errorMsg = error.stack; + //`[${options.site.name}]获取种子信息出错: ${error.stack}`; + } + + return results; + } + + /** + * 获取指定字段内容 + * @param {*} row + * @param {*} cells + * @param {*} fieldIndex + * @param {*} fieldName + */ + getFieldValue(row, cells, fieldIndex, fieldName, returnCell) { + let parent = row; + let cell = null; + if ( + cells && + fieldIndex && + fieldIndex[fieldName] !== undefined && + fieldIndex[fieldName] !== -1 + ) { + cell = cells.eq(fieldIndex[fieldName]); + parent = cell || row; + } + + let result = Searcher.getFieldValue(this.site, parent, fieldName); + + if (!result && cell) { + if (returnCell) { + return cell; + } + result = cell.text(); + } + + return result; + } + + /** + * 获取时间 + * @param {*} cell + */ + getTime(cell) { + let time = cell.find("span[title],time[title]").attr("title"); + if (!time) { + time = $("") + .html(cell.html().replace("
", " ")) + .text(); + } + if (options.site.host === "pt.sjtu.edu.cn") { + if (time.match(/\d+[分时天月年]/g)) { + time = Date.now() - this._parseTime(time) + time = new Date(time).toLocaleString("zh-CN", {hour12: false}).replace(/\//g, '-') + } + } + return time || ""; + } + + _parseTime(timeString) { + const timeMatch = timeString.match(/\d+[分时天月年]/g) + let length = 0 + timeMatch.forEach(time => { + const timeMatch = time.match(/(\d+)([分时天月年])/) + const number = parseInt(timeMatch[1]) + const unit = timeMatch[2] + switch (true) { + case unit === '分': + length += number + break + case unit === '时': + length += number * 60 + break + case unit === '天': + length += number * 60 * 24 + break + case unit === '月': + length += number * 60 * 24 * 30 + break + case unit === '年': + length += number * 60 * 24 * 365 + break + default: + } + }) + return length * 60 * 1000 + } + + /** + * 获取标题 + */ + getTitle(row, cells, fieldIndex) { + let title = + this.getFieldValue(row, cells, fieldIndex, "title", true) || + row.find("a[href*='hit'][title]:not(a[href*='comment'])").first(); + + if (typeof title === "string") { + return title; + } + + if (title.length == 0) { + title = row.find("a[href*='hit']:has(b)").first(); + } + + if (title.length == 0) { + // 特殊情况处理 + switch (options.site.host) { + case "u2.dmhy.org": + title = row.find("a.tooltip[href*='hit']").first(); + break; + } + } + + // 对title进行处理,防止出现cf的email protect + let cfemail = title.find("span.__cf_email__"); + if (cfemail.length > 0) { + cfemail.each((index, el) => { + $(el).replaceWith(Searcher.cfDecodeEmail($(el).data("cfemail"))); + }); + } + + return title; + } + + /** + * 获取副标题 + * @param {*} title + * @param {*} row + */ + getSubTitle(title, row) { + let subTitle = Searcher.getFieldValue(this.site, row, "subTitle"); + if (subTitle) { + return subTitle; + } + + try { + subTitle = title + .parent() + .html() + .split("
"); + if (subTitle && subTitle.length > 1) { + subTitle = $("") + .html(subTitle[subTitle.length - 1]) + .text(); + } else { + // 特殊情况处理 + switch (options.site.host) { + case "hdchina.org": + if ( + title + .parent() + .next() + .is("h4") + ) { + subTitle = title + .parent() + .next() + .text(); + } + break; + + case "tp.m-team.cc": + case "pt.m-team.cc": + case "kp.m-team.cc": + title = row.find("a[href*='hit'][title]").last(); + subTitle = title + .parent() + .html() + .split("
"); + subTitle = $("") + .html(subTitle[subTitle.length - 1]) + .text(); + break; + + case "u2.dmhy.org": + subTitle = $(".torrentname > tbody > tr:eq(1)", row) + .find(".tooltip") + .text(); + break; + + case "whu.pt": + case "hudbt.hust.edu.cn": + subTitle = $("h3", row).text(); + break; + + default: + subTitle = ""; + break; + } + } + + return subTitle || ""; + } catch (error) { + return ""; + } + } + + // 很 + getDownloadLink(row, link) { + let url; + switch (options.site.host) { + case 'hdsky.me': { + let url_another = row.find('form[action*="download.php"]:eq(0)') + if (url_another.length > 0) { + url = url_another.attr('action') + break; + } + + } + + default: { + let url_another = row.find("img.download").parent(); + + if (url_another.length) { + if (url_another.get(0).tagName !== "A") { + let id = link.getQueryString("id"); + url = `download.php?id=${id}`; + } else { + url = url_another.attr("href"); + } + } else { + let id = link.getQueryString("id"); + url = `download.php?id=${id}`; + } + url = url + "&https=1" + } + } + + return url; + } + + /** + * 获取分类 + * @param {*} cell 当前列 + */ + getCategory(cell) { + let result = { + name: "", + link: "" + }; + let link = cell.find("a:first"); + let img = link.find("img:first"); + + if (link.length) { + result.link = link.attr("href"); + if (result.link.substr(0, 4) !== "http") { + result.link = options.site.url + result.link; + } + } + + if (img.length) { + result.name = img.attr("title") || img.attr("alt"); + } else { + result.name = link.text(); + } + return result; + } + } + + let parser = new Parser(options); + options.results = parser.getResult(); + console.log(options.results); +})(options, options.searcher); diff --git a/resource/sites/asiancinema.me/config.json b/resource/sites/asiancinema.me/config.json index 18e6e6a97..a95eb591d 100644 --- a/resource/sites/asiancinema.me/config.json +++ b/resource/sites/asiancinema.me/config.json @@ -12,11 +12,11 @@ "resultType": "html", "parseScriptFile": "/sites/asiancinema.me/getSearchResult.js", "resultSelector": "div.table-responsive > table:first", - "queryString": "search=$key$", + "queryString": "search=$key$&qty=100", "area": [{ "name": "IMDB", "keyAutoMatch": "^(tt\\d+)$", - "queryString": "imdb=$key$", + "queryString": "imdb=$key$&qty=100", "replaceKey": [ "tt", "" ] diff --git a/resource/sites/club.hares.top/config.json b/resource/sites/club.hares.top/config.json index 1b0d70e83..def5b6296 100644 --- a/resource/sites/club.hares.top/config.json +++ b/resource/sites/club.hares.top/config.json @@ -36,7 +36,7 @@ "div[title^='leeching'], div[title^='seeding'], div[title^='inactivity']" ], "filters": [ - "query ? query.attr('title').replace('leeching','').replace('seeding','').replace('inactivity','').replace('%','').trim() : null" + "query[0] ? query.attr('title').replace('leeching','').replace('seeding','').replace('inactivity','').replace('%','').trim() : null" ] }, "status": { @@ -172,34 +172,20 @@ "selector": [ ".layui-row.layui-userdetails.layui-poll-con.layui-margin-bottom table tbody td:eq(10)" ], - "filters": ["query.text()"] + "filters": [ "query.text()" ] }, "bonus": { "selector": [ ".layui-row.layui-userdetails.layui-poll-con.layui-margin-bottom table tbody td:eq(8)" ], - "filters": ["query.html()"] - } - } - }, - "userSeedingTorrents": { - "page": "/getusertorrentlistajax.php?userid=$user.id$&type=seeding", - "fields": { - "seedingSize": { - "selector": "", - "filters": [ - "query.text().match(/总大小:(.*?)类型/g)", - "(query && query.length>0 ) ? query[0].replace('总大小:', '').replace('类型', '').trim() : 0", - "(query != 0) ? query.sizeToNumber() : 0" - ] + "filters": [ "query.html()" ] }, "seeding": { - "selector": "", - "filters": [ - "query.text().match(/(.*?)条记录/g)", - "(query && query.length>0 ) ? query[0].replace('条记录', '').trim() : 0", - "(query != 0) ? query : 0" - ] + "selector": [ "i.fas.fa-upload.text-success.fa-fw + span.list-info" ], + "filters": ["query.text().trim()"] + }, + "seedingSize": { + "value": -1 } } } diff --git a/resource/sites/pt.btschool.club/config.json b/resource/sites/pt.btschool.club/config.json index 367787947..ef1a8d8dd 100644 --- a/resource/sites/pt.btschool.club/config.json +++ b/resource/sites/pt.btschool.club/config.json @@ -4,26 +4,43 @@ "description": "汇聚每一个人的影响力", "url": "https://pt.btschool.club/", "icon": "https://pt.btschool.club/favicon.ico", - "tags": ["影视", "综合"], + "tags": [ "影视", "综合" ], "schema": "NexusPHP", "host": "pt.btschool.club", "formerHosts": [ "pt.btschool.net" ], "searchEntryConfig": { - "area": [{ - "name": "IMDB", - "keyAutoMatch": "^(tt\\d+)$", - "appendQueryString": "&search_area=1" - }], + "area": [ + { + "name": "IMDB", + "keyAutoMatch": "^(tt\\d+)$", + "appendQueryString": "&search_area=1" + } + ], "fieldSelector": { "progress": { - "selector": [".progress:eq(0) > div"], - "filters": ["query.attr('style')||''", "query.match(/width:([ \\d.]+)%/)", "(query && query.length>=2)?query[1]:null"] + "selector": [ ".progress:eq(0) > div" ], + "filters": [ "query.attr('style')||''", "query.match(/width:([ \\d.]+)%/)", "(query && query.length>=2)?query[1]:null" ] }, "status": { - "selector": [".progress:eq(0) > div"], - "filters": ["query.attr('class')", "query=='progress_seeding'?2:(query=='progress_completed'?255:(query=='progress_no_downloading'?3:1))"] + "selector": [ ".progress:eq(0) > div" ], + "filters": [ "query.attr('class')", "query=='progress_seeding'?2:(query=='progress_completed'?255:(query=='progress_no_downloading'?3:1))" ] + } + } + }, + "selectors": { + "userExtendInfo": { + "merge": true, + "fields": { + "seeding": { + "selector": [ "span.medium img.arrowup" ], + "filters": [ "$(query[0].nextSibling).text().trim().replace(/,/g,'')" ] + }, + "seedingSize": { + "selector": [ "td.rowhead:contains('当前做种') + td", "td.rowhead:contains('目前做種') + td", "td.rowhead:contains('Current Seeding') + td" ], + "filters": [ "query.text().replace(/.*共计/g,'').replace(')','')", "query.sizeToNumber()" ] + } } } } diff --git a/resource/sites/speedapp.io/config.json b/resource/sites/speedapp.io/config.json index 29aa4aa6f..9ef64360a 100644 --- a/resource/sites/speedapp.io/config.json +++ b/resource/sites/speedapp.io/config.json @@ -45,7 +45,7 @@ }, "time": { "selector": [""], - "filters": ["query.attr('title')","dateTime(query).valueOf()?dateTime(query):query"] + "filters": [ "query.attr('title')", "dateTime(query).isValid() ? dateTime(query).valueOf() : dateTime(query.replace('下午','PM ').replace('上午','AM ').replace('日','').replaceAll(/年|月/g,'-'), 'YYYY-M-D A hh:mm:ss').format('YYYY-M-D HH:mm')" ] }, "seeders": { "selector": ["span:contains('seeders')"], @@ -119,10 +119,9 @@ "selector": ["div.card-body.pt-4 >div.align-items-center div.text-muted"], "filters": ["query.text().replace(/,|\\s|\\n/g,'')"] }, - - "joinTime": { + "joinTime": { "selector": ["dt:contains('注册日期') + dd, dt:contains('Signup date') + dd, dt:contains('Data inregistrarii') + dd"], - "filters": ["dateTime(query.text()).valueOf()"] + "filters": [ "query.text()", "dateTime(query).isValid() ? dateTime(query).valueOf() : dateTime(query.replace('下午','PM ').replace('上午','AM ').replace('日','').replaceAll(/年|月/g,'-'), 'YYYY-M-D A hh:mm:ss').valueOf()" ] }, "seedingSize": { "selector": ["dt:contains('奖励积分') + dd > b:nth-of-type(2)","dt:contains('Bonus points') + dd > b:nth-of-type(2)","dt:contains('Puncte bonus') + dd > b:nth-of-type(2)"], diff --git a/resource/sites/www.hdarea.co/config.json b/resource/sites/www.hdarea.co/config.json index 28aa03bc9..6695ee7ff 100644 --- a/resource/sites/www.hdarea.co/config.json +++ b/resource/sites/www.hdarea.co/config.json @@ -1,215 +1,226 @@ -{ - "name": "HDArea", - "timezoneOffset": "+0800", - "schema": "NexusPHP", - "url": "https://www.hdarea.co/", - "description": "高清世界", - "icon": "https://www.hdarea.co/favicon.ico", - "tags": [ - "影视", - "综合" - ], - "host": "www.hdarea.co", - "collaborator": "lzl20110", - "searchEntryConfig": { - "fieldSelector": { - "progress": { - "selector": [ - "table[title='downloading'] > tbody > tr > td > div", - "table[title='seeding'] > tbody > tr > td > div", - "table[title='Stopped'] > tbody > tr > td > div", - "table[title='completed'] > tbody > tr > td > div" - ], - "filters": ["query.attr('style')||''", "query.match(/width:.?(\\d.+)%/)", "(query && query.length>=2)?query[1]:null"] - }, - "status": { - "selector": [ - "table[title='downloading']", - "table[title='seeding']", - "table[title='Stopped']", - "table[title='completed']" - ], - "switchFilters": [ - ["1"], - ["2"], - ["3"], - ["255"] - ] - } - } - }, - "searchEntry": [{ - "name": "全站", - "enabled": true - }, - { - "queryString": "cat401=1", - "name": "Movies Blu-ray", - "enabled": false - }, - { - "queryString": "cat415=1", - "name": "Movies REMUX", - "enabled": false - }, - { - "queryString": "cat416=1", - "name": "Movies 3D", - "enabled": false - }, - { - "queryString": "cat410=1", - "name": "Movies 1080p", - "enabled": false - }, - { - "queryString": "cat411=1", - "name": "Movies 720p", - "enabled": false - }, - { - "queryString": "cat414=1", - "name": "Movies DVD", - "enabled": false - }, - { - "queryString": "cat412=1", - "name": "Movies WEB-DL", - "enabled": false - }, - { - "queryString": "cat413=1", - "name": "Movies HDTV", - "enabled": false - }, - { - "queryString": "cat417=1", - "name": "Movies iPad", - "enabled": false - }, - { - "queryString": "cat404=1", - "name": "Documentaries", - "enabled": false - }, - { - "queryString": "cat405=1", - "name": "Animations", - "enabled": false - }, - { - "queryString": "cat402=1", - "name": "TV Series", - "enabled": false - }, - { - "queryString": "cat403=1", - "name": "TV Shows", - "enabled": false - }, - { - "queryString": "cat406=1", - "name": "Music Videos", - "enabled": false - }, - { - "queryString": "cat407=1", - "name": "Sports", - "enabled": false - }, - { - "queryString": "cat409=1", - "name": "Misc", - "enabled": false - }, - { - "queryString": "cat408=1", - "name": "HQ Audio", - "enabled": false - } - ], - "categories": [{ - "entry": "torrents.php", - "result": "&cat$id$=1", - "category": [{ - "id": 401, - "name": "Movies Blu-ray" - }, - { - "id": 415, - "name": "Movies REMUX" - }, - { - "id": 416, - "name": "Movies 3D" - }, - { - "id": 410, - "name": "Movies 1080p" - }, - { - "id": 411, - "name": "Movies 720p" - }, - { - "id": 414, - "name": "Movies DVD" - }, - { - "id": 412, - "name": "Movies WEB-DL" - }, - { - "id": 413, - "name": "Movies HDTV" - }, - { - "id": 417, - "name": "Movies iPad" - }, - { - "id": 404, - "name": "Documentaries" - }, - { - "id": 405, - "name": "Animations" - }, - { - "id": 402, - "name": "TV Series" - }, - { - "id": 403, - "name": "TV Shows" - }, - { - "id": 406, - "name": "Music Videos" - }, - { - "id": 407, - "name": "Sports" - }, - { - "id": 409, - "name": "Misc" - }, - { - "id": 408, - "name": "HQ Audio" - } - ] - }], - "selectors": { - "/details.php": { - "merge": true, - "fields": { - "downloadURL": { - "selector": ["td.rowfollow:contains('&passkey='):last"], - "filters": ["query[0].childNodes[0].textContent"] - } - } - } - } +{ + "name": "HDArea", + "timezoneOffset": "+0800", + "schema": "NexusPHP", + "url": "https://www.hdarea.co/", + "description": "高清世界", + "icon": "https://www.hdarea.co/favicon.ico", + "tags": [ + "影视", + "综合" + ], + "host": "www.hdarea.co", + "collaborator": "lzl20110", + "searchEntryConfig": { + "fieldSelector": { + "progress": { + "selector": [ + "table[title='downloading'] > tbody > tr > td > div", + "table[title='seeding'] > tbody > tr > td > div", + "table[title='Stopped'] > tbody > tr > td > div", + "table[title='completed'] > tbody > tr > td > div" + ], + "filters": [ "query.attr('style')||''", "query.match(/width:.?(\\d.+)%/)", "(query && query.length>=2)?query[1]:null" ] + }, + "status": { + "selector": [ + "table[title='downloading']", + "table[title='seeding']", + "table[title='Stopped']", + "table[title='completed']" + ], + "switchFilters": [ + [ "1" ], + [ "2" ], + [ "3" ], + [ "255" ] + ] + } + } + }, + "searchEntry": [ + { + "name": "全站", + "enabled": true + }, + { + "queryString": "cat401=1", + "name": "Movies Blu-ray", + "enabled": false + }, + { + "queryString": "cat415=1", + "name": "Movies REMUX", + "enabled": false + }, + { + "queryString": "cat416=1", + "name": "Movies 3D", + "enabled": false + }, + { + "queryString": "cat410=1", + "name": "Movies 1080p", + "enabled": false + }, + { + "queryString": "cat411=1", + "name": "Movies 720p", + "enabled": false + }, + { + "queryString": "cat414=1", + "name": "Movies DVD", + "enabled": false + }, + { + "queryString": "cat412=1", + "name": "Movies WEB-DL", + "enabled": false + }, + { + "queryString": "cat413=1", + "name": "Movies HDTV", + "enabled": false + }, + { + "queryString": "cat417=1", + "name": "Movies iPad", + "enabled": false + }, + { + "queryString": "cat404=1", + "name": "Documentaries", + "enabled": false + }, + { + "queryString": "cat405=1", + "name": "Animations", + "enabled": false + }, + { + "queryString": "cat402=1", + "name": "TV Series", + "enabled": false + }, + { + "queryString": "cat403=1", + "name": "TV Shows", + "enabled": false + }, + { + "queryString": "cat406=1", + "name": "Music Videos", + "enabled": false + }, + { + "queryString": "cat407=1", + "name": "Sports", + "enabled": false + }, + { + "queryString": "cat409=1", + "name": "Misc", + "enabled": false + }, + { + "queryString": "cat408=1", + "name": "HQ Audio", + "enabled": false + } + ], + "categories": [ + { + "entry": "torrents.php", + "result": "&cat$id$=1", + "category": [ + { + "id": 401, + "name": "Movies Blu-ray" + }, + { + "id": 415, + "name": "Movies REMUX" + }, + { + "id": 416, + "name": "Movies 3D" + }, + { + "id": 410, + "name": "Movies 1080p" + }, + { + "id": 411, + "name": "Movies 720p" + }, + { + "id": 414, + "name": "Movies DVD" + }, + { + "id": 412, + "name": "Movies WEB-DL" + }, + { + "id": 413, + "name": "Movies HDTV" + }, + { + "id": 417, + "name": "Movies iPad" + }, + { + "id": 404, + "name": "Documentaries" + }, + { + "id": 405, + "name": "Animations" + }, + { + "id": 402, + "name": "TV Series" + }, + { + "id": 403, + "name": "TV Shows" + }, + { + "id": 406, + "name": "Music Videos" + }, + { + "id": 407, + "name": "Sports" + }, + { + "id": 409, + "name": "Misc" + }, + { + "id": 408, + "name": "HQ Audio" + } + ] + } + ], + "fieldSelector": { + "merge": true, + "title": { + "selector": [ "a.title:not(a[href*='comment']),a[onmouseover*='get_ext_info_ajax']" ], + "filters": [ "query.text()" ] + } + }, + "selectors": { + "/details.php": { + "merge": true, + "fields": { + "downloadURL": { + "selector": [ "td.rowfollow:contains('&passkey='):last" ], + "filters": [ "query[0].childNodes[0].textContent" ] + } + } + } + } } \ No newline at end of file diff --git a/resource/sites/www.morethantv.me/config.json b/resource/sites/www.morethantv.me/config.json index 2ab65a9ed..016192f3e 100644 --- a/resource/sites/www.morethantv.me/config.json +++ b/resource/sites/www.morethantv.me/config.json @@ -20,6 +20,47 @@ "pages": ["/torrents/browse", "/show/(\\d+)/$","/collages.php"], "scripts": ["/schemas/NexusPHP/common.js", "/schemas/Common/torrents.js"] }], + "searchEntry": [{ + "name": "全部", + "enabled": true + }], + "searchEntryConfig": { + "page": "torrents/browse?searchtext=$key$", + "skipIMDbId": true, + "name": "全部", + "resultType": "html", + "resultSelector": "table.torrent_table", + "dataRowSelector": "> tbody > tr:not(:first-child)", + "fieldIndex": { + "title": 1, + "link": 1, + "url": 1, + "time": 3, + "size": 4, + "author": 8, + "seeders": 6, + "leechers": 7, + "completed": 5 + }, + "fieldSelector": { + "title": { + "selector": ["a.overlay_torrent"], + "filters": ["query.text()"] + }, + "link": { + "selector": ["a.overlay_torrent"], + "filters": ["query.attr('href')", "'https://www.morethantv.me/'+query"] + }, + "url": { + "selector": ["a[title='Download Torrent']"], + "filters": ["query.attr('href')", "'https://www.morethantv.me/'+query"] + }, + "time": { + "selector": ["span.time"], + "filters": ["dateTime(query.attr('title')).format()"] + } + } + }, "selectors": { "userBaseInfo": { "merge": true, diff --git a/src/background/user.ts b/src/background/user.ts index 028a8313c..f5b801afe 100644 --- a/src/background/user.ts +++ b/src/background/user.ts @@ -187,6 +187,7 @@ export class User { }) .catch((error: any) => { userInfo.lastUpdateStatus = EUserDataRequestStatus.unknown; + console.log("getInfos Error :",error); //this.updateStatus(site, userInfo); rejectFN(APP.createErrorMessage(error)); });