From 9101724cab7d8589e7bad08e58c6e7a613d8eb1b Mon Sep 17 00:00:00 2001 From: MewX Date: Wed, 29 Dec 2021 23:45:14 +1100 Subject: [PATCH] fix: #923 AB cannot batch download --- resource/sites/animebytes.tv/config.json | 24 +++++++++++- resource/sites/animebytes.tv/userTorrents.js | 39 ++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 resource/sites/animebytes.tv/userTorrents.js diff --git a/resource/sites/animebytes.tv/config.json b/resource/sites/animebytes.tv/config.json index 23bd75279..ccb4aaa9b 100644 --- a/resource/sites/animebytes.tv/config.json +++ b/resource/sites/animebytes.tv/config.json @@ -5,14 +5,36 @@ "url": "https://animebytes.tv/", "icon": "https://animebytes.tv/favicon.ico", "tags": ["动漫"], - "schema": "Gazelle", + "schema": "", "host": "animebytes.tv", + "collaborator": [ + "sabersalv", + "MewX" + ], "supportedFeatures": { "userData": true, "search": false, "imdbSearch": false, "sendTorrent": false }, + "plugins": [ + { + "name": "Custom Torrent List", + "pages": [ + "/series.php", + "/torrents.php", + "/torrents2.php" + ], + "scripts": [ + "/schemas/NexusPHP/common.js", + "userTorrents.js" + ] + } + ], + "securityKeyFields": [ + "authkey", + "torrent_pass" + ], "selectors": { "userBaseInfo": { "page": "/index.php", diff --git a/resource/sites/animebytes.tv/userTorrents.js b/resource/sites/animebytes.tv/userTorrents.js new file mode 100644 index 000000000..a96e278b0 --- /dev/null +++ b/resource/sites/animebytes.tv/userTorrents.js @@ -0,0 +1,39 @@ +(function ($) { + console.log("this is userTorrents.js"); + class App extends window.NexusPHPCommon { + init() { + this.initButtons(); + this.initFreeSpaceButton(); + // 设置当前页面 + PTService.pageApp = this; + } + + /** + * 初始化按钮列表 + */ + initButtons() { + this.initListButtons(); + } + + /** + * 获取下载链接 + */ + getDownloadURLs() { + let links = $("a[title='Download torrent']").toArray(); + console.log(links); + + if (links.length == 0) { + return this.t("getDownloadURLsFailed"); //"获取下载链接失败,未能正确定位到链接"; + } + + let urls = $.map(links, item => { + let link = $(item).attr("href"); + return this.getFullURL(link); + }); + console.log(urls); + + return urls; + } + } + new App().init(); +})(jQuery);