自动获取磁链接并自动离线下载
< Відгуки до 挊-随时开车
nyaa.si 其实还能用,能搜到结果,但是拼接最后链接的代码有问题,需要手动改630行和632行的代码,主要是改成https://sukebei.nyaa.si,然后不能用.href拿绝对路径(会加上多余的javlibrary.com),而应该用.getAttribute("href")拿相对路径。有能力的自己改两行就行了: onload: function (result) { let doc = common.parsetext(result.responseText); let data = []; let t = doc.querySelectorAll("tr.default"); if (t.length!==0) { for (let elem of t) { console.log(elem.querySelector("td:nth-child(3)>a:nth-child(1)")); data.push({ "title": elem.querySelector("td:nth-child(2)>a:nth-child(1)").title, "mag": "", "torrent_url": "https://sukebei.nyaa.si" + elem.querySelector("td:nth-child(3)>a:nth-child(1)").getAttribute("href"), "size": elem.querySelector("td:nth-child(4)").textContent, "src": "https://sukebei.nyaa.si" + elem.querySelector("td:nth-child(2)>a:nth-child(1)").getAttribute("href"), }); } } else { data.push({ "title": "没有找到磁链接", "mag": "", "torrent_url": "", "size": "0", "src": result.finalUrl, }); } cb(result.finalUrl, data); },
onload: function (result) { let doc = common.parsetext(result.responseText); let data = []; let t = doc.querySelectorAll("tr.default"); if (t.length!==0) { for (let elem of t) { console.log(elem.querySelector("td:nth-child(3)>a:nth-child(1)")); data.push({ "title": elem.querySelector("td:nth-child(2)>a:nth-child(1)").title, "mag": "", "torrent_url": "https://sukebei.nyaa.si" + elem.querySelector("td:nth-child(3)>a:nth-child(1)").getAttribute("href"), "size": elem.querySelector("td:nth-child(4)").textContent, "src": "https://sukebei.nyaa.si" + elem.querySelector("td:nth-child(2)>a:nth-child(1)").getAttribute("href"), }); } } else { data.push({ "title": "没有找到磁链接", "mag": "", "torrent_url": "", "size": "0", "src": result.finalUrl, }); } cb(result.finalUrl, data); },
Sign in to post a reply.
nyaa.si 其实还能用,能搜到结果,但是拼接最后链接的代码有问题,需要手动改630行和632行的代码,主要是改成https://sukebei.nyaa.si,然后不能用.href拿绝对路径(会加上多余的javlibrary.com),而应该用.getAttribute("href")拿相对路径。有能力的自己改两行就行了:
onload: function (result) {
let doc = common.parsetext(result.responseText);
let data = [];
let t = doc.querySelectorAll("tr.default");
if (t.length!==0) {
for (let elem of t) {
console.log(elem.querySelector("td:nth-child(3)>a:nth-child(1)"));
data.push({
"title": elem.querySelector("td:nth-child(2)>a:nth-child(1)").title,
"mag": "",
"torrent_url": "https://sukebei.nyaa.si" + elem.querySelector("td:nth-child(3)>a:nth-child(1)").getAttribute("href"),
"size": elem.querySelector("td:nth-child(4)").textContent,
"src": "https://sukebei.nyaa.si" + elem.querySelector("td:nth-child(2)>a:nth-child(1)").getAttribute("href"),
});
}
}
else {
data.push({
"title": "没有找到磁链接",
"mag": "",
"torrent_url": "",
"size": "0",
"src": result.finalUrl,
});
}
cb(result.finalUrl, data);
},