Skip to content

Instantly share code, notes, and snippets.

@fanzeyi
Created June 1, 2018 06:15
Show Gist options
  • Select an option

  • Save fanzeyi/3a86e342cf5d45a9c836e84a75b6ba9b to your computer and use it in GitHub Desktop.

Select an option

Save fanzeyi/3a86e342cf5d45a9c836e84a75b6ba9b to your computer and use it in GitHub Desktop.
(function() {
function escapeQuote(str) {
return str.replace("\"", "\\\"");
}
function buildAria2Url(name, url) {
return `aria2c -c -s10 -k1M -x16 --enable-rpc=false ` +
`-o "${escapeQuote(name)}" ` +
`--header "${escapeQuote(window.navigator.userAgent)}" ` +
`--header "Referer: ${escapeQuote(window.location.toString())}" ` +
`--header "Cookie: ${escapeQuote(window.document.cookie)}" ` +
`"${escapeQuote(url)}"`;
}
const id = Math.random().toString(36).substring(7);
webpackJsonp([2], {
[id]: function(m, e, r) {
const lookupWYFunction = function(name) {
return Object.values(r.c).map((x) => x.exports).filter((x) => x[name] !== undefined);
};
const list = document.querySelector(".list-group-bd").__vue__.selectedList;
const getSingleUrl = lookupWYFunction("getSingleUrl")[0].getSingleUrl;
list.map(node => {
getSingleUrl(node).then(data => {
console.log(buildAria2Url(node.getName(), data.https_download_url));
}, error => {
console.warn(error);
});
});
}
}, [id]);
})();
@JayXon
Copy link
Copy Markdown

JayXon commented Sep 16, 2018

Doesn't work for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment