PT-Plugin-Plus
PT-Plugin-Plus copied to clipboard
修正HDChina种子列表复制链接的问题
- PT 助手版本:
- PT 助手安装方式:(市场安装,或zip包安装)
- 浏览器名称及版本:
- 浏览器是否安装了其他插件:
- 停用其他插件后是否正常工作:
- 问题描述:
如我在上一个issue里面提到的 #556
一般的NP架构的站点种子直链都是这样的
https://<nexusphp.privatetracker.site>/download.php?id=<torrentid>&passkey=<mypasskey>&https=1但是HDChina是这样的https://hdchina.org/download.php?hash=<hash>&uid=<uid>&https=1
导致的问题就是,我在站点设置里面填入了我的passkey。HDChina复制出来的链接是这样的
https://hdchina.org/download.php?hash=<hash>&passkey=<mypasskey>&https=1
然后访问会显示:您访问的页面不存在
如何解决这个问题: 1、对HDChina进行单独适配,修改种子链接的模板 2、在HDChina站点设置中,把“密钥”这一栏换一种说法,变成UID。 3、解决问题
-
相关截图:

-
重现步骤:
实际上,passkey并不是必填的。~~在HDC这个站点,不填反而会提取出正常的链接。~~ 不对,不填提取出来的缺少uid信息。
@ronggang 能否考虑把站点设置中的密钥一栏,改成和搜索方案配置一样,采用追加下载链接参数的形式。 随着我们将种子推送改成本地下载之后,原来站点设置中密钥栏显得并无多大作用。 前面 #361 也有用户提出对下载链接提出额外的params请求,但当初的解决方法是使用自定义插件。 此外,就目前链接提取的实现来看 https://github.com/ronggang/PT-Plugin-Plus/blob/c7b238304d6e237fa71290b4a49beb6c8d136b6f/resource/schemas/NexusPHP/torrents.js#L49-L59 对参数附加也过于固定,这方面开放给用户可能会更好。

什么都不填是那个只有hash的链接吗?那个并不能在没有cookie的情况下下载…
自定义插件我研究一下…
自定义脚本,注意UID那脚本里需要写死,自行更改
抄了下作业
仅在torrents.php 页面使用

(function($) {
console.log("this is torrent.js");
class App extends window.NexusPHPCommon {
init() {
this.initButtons();
this.initFreeSpaceButton();
// 设置当前页面
PTService.pageApp = this;
}
/**
* 初始化按钮列表
*/
initButtons() {
this.getDownloadURLsAddUID();
}
/**
* 获取下载链接
*/
getDownloadURLsAddUID() {
PTService.addButton({
title: "复制添加UID",
icon: "file_copy",
label: this.t("buttons.copyAllToClipboard"),
click: (success, error) => {
let links = $("a[href*='download']").toArray();
let siteURL = PTService.site.url;
if (siteURL.substr(-1) != "/") {
siteURL += "/";
}
if (links.length == 0) {
links = $(".torrentname a[href*='details.php']").toArray();
}
if (links.length == 0) {
// "获取下载链接失败,未能正确定位到链接";
return this.t("getDownloadURLsFailed");
}
let urls = $.map(links, item => {
let url = $(item)
.attr("href")
.replace(/details\.php/gi, "download.php");
if (url) {
if (url.substr(0, 2) === "//") {
// 适配HUDBT、WHU这样以相对链接开头
url = location.protocol + url;
} else if (url.substr(0, 4) !== "http") {
url = siteURL + url;
}
url += "&uid=XX";
if (
url &&
url.indexOf("https=1") === -1 &&
!PTService.site.disableHttps
) {
url += "&https=1";
}
}
return url;
});
PTService.call(PTService.action.copyTextToClipboard, urls.join("\n"))
.then(result => {
console.log("命令执行完成", result);
success();
})
.catch(() => {
error();
});
}
});
}
}
new App().init();
})(jQuery);
临时使用,detail就懒得弄了,感觉直接右键复制就行
瓷佬,伟大! 但我希望插件在日后还是能改一改。这毕竟只是权宜之计
看了一下,和 #573 的问题还是有些不一样。还是等一下 @ronggang 关于前面意见的想法吧。 https://github.com/ronggang/PT-Plugin-Plus/issues/557#issuecomment-652791092
@Rhilip 额外的 params 方式倒是可以考虑一下。
fix: 946bed92dc16fcdb57c8671c956b34ad060460c7