Skip to content

Commit

Permalink
Merge pull request #42 from ronggang/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Bright-W authored Oct 31, 2022
2 parents eb0c0b3 + 440ddef commit 962ecfb
Show file tree
Hide file tree
Showing 6 changed files with 416 additions and 17 deletions.
42 changes: 26 additions & 16 deletions resource/sites/club.hares.top/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"merge": true,
"fields": {
"messageCount": {
"selector": [".unread"],
"selector": [ ".unread" ],
"filters": [
"query.text().match(/(\\d+)/)",
"(query && query.length>=2)?parseInt(query[1]):0"
Expand Down Expand Up @@ -182,23 +182,33 @@
},
"seeding": {
"selector": [ "i.fas.fa-upload.text-success.fa-fw + span.list-info" ],
"filters": ["query.text().trim()"]
},
"filters": [ "query.text().trim()" ]
}
}
},
"userSeedingTorrents": {
"page": "/getusertorrentlistajax.php?page=1&limit=50&uid=$user.id$&type=seeding",
"dataType": "json",
"headers": {
"Accept": "application/json, text/javascript, */*; q=0.01"
},
"fields": {
"seedingSize": {
"value": -1
"selector": [ "size" ],
"filters": [ "query.sizeToNumber()" ]
}
}
}
},
"plugins": [
{
"name": "官方列表",
"pages": ["/official.php"],
"scripts": [
"/schemas/NexusPHP/common.js",
"/schemas/NexusPHP/torrents.js"
]
}
],
"mergeSchemaTagSelectors": true
}
"plugins": [
{
"name": "官方列表",
"pages": [ "/official.php" ],
"scripts": [
"/schemas/NexusPHP/common.js",
"/schemas/NexusPHP/torrents.js"
]
}
],
"mergeSchemaTagSelectors": true
}
68 changes: 68 additions & 0 deletions resource/sites/world-in-hd.net/browse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
(function($) {
console.log("this is browse.js");
class App extends window.NexusPHPCommon {
init() {
this.initButtons();
this.initFreeSpaceButton();
// 设置当前页面
PTService.pageApp = this;
}

/**
* 初始化按钮列表
*/
initButtons() {
this.initListButtons();
}

/**
* 获取下载链接
*/
getDownloadURLs() {
let links = $(
"div.download-item a[href*='/torrents/download/']"
).toArray();
let siteURL = PTService.site.url;
if (siteURL.substr(-1) == "/") {
siteURL = siteURL.substr(0,siteURL.length-1);
}

if (links.length == 0) {
// "获取下载链接失败,未能正确定位到链接";
return this.t("getDownloadURLsFailed");
}

let urls = $.map(links, item => {
let link = $(item).attr("href");
if (link && link.substr(0, 4) != "http") {
link = siteURL + link;
}
return link;
});

return urls;
}

/**
* 确认大小是否超限
*/
confirmWhenExceedSize() {
return this.confirmSize(
$("div.torrent-h3 > span").text().split("-")[1].trim().replace('o','B')
);
}

/**
* 获取有效的拖放地址
* @param {*} url
*/
getDroperURL(url) {
if (url.indexOf("download") === -1) {
return "";
}

return url;
}
}
new App().init();
})(jQuery);
81 changes: 81 additions & 0 deletions resource/sites/world-in-hd.net/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"name": "WiHD",
"timezoneOffset": "+0200",
"schema": "WiHD",
"url": "https://world-in-hd.net/",
"icon": "https://world-in-hd.net/media/cache/icon32/appicon.png",
"tags": ["影视"],
"host": "world-in-hd.net",
"collaborator": "luckiestone",
"plugins": [{
"name": "种子详情页面",
"pages": ["/torrent/view/"],
"scripts": ["/schemas/NexusPHP/common.js", "details.js"]
}, {
"name": "种子列表",
"pages": ["/torrents"],
"scripts": ["/schemas/NexusPHP/common.js", "browse.js"]
}],
"searchEntryConfig": {
"skipIMDbId": true,
"page": "/torrent/ajaxsearchtorrent/$key$",
"resultType": "html",
"parseScriptFile": "getSearchResult.js",
"resultSelector": "div.torrent-body"
},
"supportedFeatures": {
"imdbSearch": false,
"userData": ""
},
"searchEntry": [{
"name": "all",
"enabled": true
}],
"torrentTagSelectors": [{
"name": "Free",
"selector": "div.fl-item"
}],
"selectors": {
"userBaseInfo": {
"page": "/",
"fields": {
"name": {
"selector": "span.username"
},
"bonus": {
"value": "N/A"
},
"messageCount": {
"selector": ["li.messages li.message", "li.notifications li.notification"],
"filters": ["(query && query.length>=1)?11:0"]
},
"seeding": {
"selector": ["i.fa-upload + strong"]
},
"seedingSize": {
"value": -1
}
}
},
"userExtendInfo": {
"page": "/profils/user/$user.name$",
"fields": {
"uploaded": {
"selector": ["div.stats a.btn:contains('Upload')"],
"filters": ["query.text().replace(/,/g,'').replace('o','B').match(/([\\d.]+ ?[ZEPTGMK]?i?B)/)", "(query && query.length>=2)?(query[1]).sizeToNumber():0"]
},
"downloaded": {
"selector": ["div.stats a.btn:contains('Download')"],
"filters": ["query.text().replace(/,/g,'').replace('o','B').match(/([\\d.]+ ?[ZEPTGMK]?i?B)/)", "(query && query.length>=2)?(query[1]).sizeToNumber():0"]
},
"levelName": {
"selector": "span.class"
},
"joinTime": {
"selector": "div.user-block-content:first",
"filters": ["query.text().trim()", "dateTime(query,'DD\/MM\/YYYY').isValid()?dateTime(query,'DD\/MM\/YYYY').valueOf():query"]
}
}
}
}
}
42 changes: 42 additions & 0 deletions resource/sites/world-in-hd.net/details.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
(function($, window) {
console.log("this is details.js");
class App extends window.NexusPHPCommon {
init() {
this.initButtons();
// 设置当前页面
PTService.pageApp = this;
}
/**
* 初始化按钮列表
*/
initButtons() {
this.initDetailButtons();
}

/**
* 获取下载链接
*/
getDownloadURL() {
let query = $("div.download a[href*='/torrents/download/']");
let url = "";
if (query.length > 0) {
url = query.attr("href");
}

if (!url) {
return "";
}

return `${location.origin}${url}`;
}

/**
* 获取当前种子标题
*/
getTitle() {
let title = $("header.panel-heading h2").text().trim();
return title;
}
}
new App().init();
})(jQuery, window);
Loading

0 comments on commit 962ecfb

Please sign in to comment.