-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhubcloud.js
More file actions
34 lines (33 loc) · 1.07 KB
/
hubcloud.js
File metadata and controls
34 lines (33 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//https:\/\/(?:hubcloud\.(.+)\/drive\/.+|vifix\.site\/hubcloud\/([a-z0-9]+))
function extract(url) {
return findNodes(
request({
url: findNodes(
request({
url: /^https:\/\/vifix\.site\/hubcloud\/([a-z0-9]+)$/i.test(url)
? `https://hubcloud.one/drive/${url.split("/").pop()}`
: url,
method: "GET"
}).bodyText,
"a"
).find(node => node.attributes.id == "download").attributes.href,
method: "GET"
}).bodyText,
"a"
).map(n => {
let href = n.attributes.href;
if (!href) return null;
if (href.includes("r2.dev")) {
return href;
}
if (href.includes("pixeldrain")) {
if (href.includes("/u/")) {
return "https://pixeldrain.net/api/file/" + href.split("/u/").pop();
}
if (href.includes("/api/file/")) {
return href;
}
}
return null;
}).find(Boolean);
}