Skip to content

Commit

Permalink
Merge pull request #30 from ronggang/dev
Browse files Browse the repository at this point in the history
feat(jpop): support artist.php with filter
  • Loading branch information
Bright-W authored Jul 20, 2022
2 parents 194cd8b + 6337ce4 commit 527d363
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 0 deletions.
5 changes: 5 additions & 0 deletions resource/sites/jpopsuki.eu/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"searchEntryConfig": {
"skipIMDbId": true
},
"plugins": [{
"name": "种子列表",
"pages": ["/artist.php"],
"scripts": ["/schemas/NexusPHP/common.js", "torrents.js"]
}],
"searchEntry": [{
"entry": "/torrents.php?searchstr=$key$&searchsubmit=1",
"name": "all",
Expand Down
101 changes: 101 additions & 0 deletions resource/sites/jpopsuki.eu/torrents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
(function($) {
console.log("this is torrent.js");
class App extends window.NexusPHPCommon {
init() {
// super();
this.initButtons();
this.initFreeSpaceButton();
// 设置当前页面
PTService.pageApp = this;
}

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

/**
* 获取下载链接
*/
getDownloadURLs() {
let links = $("tr:not(.filter_hide) > td > span > a[title='Download']").toArray();

if (links.length == 0) {
// 排除使用免费令牌的链接
links = $(
"a[href*='torrents.php?action=download']:not([href*='usetoken'])"
).toArray();
}

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

let urls = $.map(links, item => {
let link = $(item).attr("href");
return this.getFullURL(link);
});

return urls;
}

/**
* 确认大小是否超限
*/
confirmWhenExceedSize() {
return this.confirmSize(
$("#torrent_table, .torrent_table tr.basic-movie-list__torrent-row").find(
"td:contains('MB'),td:contains('GB'),td:contains('TB'),td:contains('MiB'),td:contains('GiB'),td:contains('TiB')"
)
);
}

/**
* 下载拖放的种子
* @param {*} url
* @param {*} callback
*/
downloadFromDroper(data, callback) {
if (typeof data === "string") {
data = {
url: data,
title: ""
};
}

console.log(data);

if (!data.url) {
PTService.showNotice({
msg: this.t("invalidURL") //"无效的链接"
});
callback();
return;
}

let authkey = data.url.getQueryString("authkey");
let torrent_pass = data.url.getQueryString("torrent_pass");
// authkey=&torrent_pass
if (!authkey && !torrent_pass) {
PTService.showNotice({
msg: this.t("dropInvalidURL") //"无效的链接,请拖放下载链接"
});
callback();
return;
}

data.url = this.getFullURL(data.url);

this.sendTorrentToDefaultClient(data)
.then(result => {
callback(result);
})
.catch(result => {
callback(result);
});
}
}
new App().init();
})(jQuery);

0 comments on commit 527d363

Please sign in to comment.