62 lines
1.6 KiB
JavaScript
62 lines
1.6 KiB
JavaScript
const axios = require("axios");
|
|
const cheerio = require("cheerio");
|
|
const lib = require("../lib");
|
|
|
|
module.exports = {
|
|
get: get,
|
|
hostnames: ["userload.co"],
|
|
tests: []
|
|
}
|
|
|
|
async function get(url, options) {
|
|
url = url.replace("/embed/", "/f/");
|
|
|
|
lib.log(`userload`, `Fetching page...`, [], true, options);
|
|
|
|
let resp = await axios({
|
|
url: url,
|
|
headers: lib.defaultHeaders
|
|
});
|
|
|
|
lib.log(`userload`, `Parsing page...`);
|
|
let $ = cheerio.load(resp.data);
|
|
|
|
let scriptData = $("body > script[type='text/javascript']:not([src])")[0].children[0].data;
|
|
let packedData = scriptData.split(`eval(function(p,a,c,k,e,d){`)[1].split(`,'|`)[1].split(`|`);
|
|
|
|
let first = packedData[4];
|
|
let second = packedData[6];
|
|
let body = `morocco=${first}&mycountry=${second}`;
|
|
|
|
lib.log(`userload`, `Got post data:`, [body]);
|
|
|
|
let headers = lib.defaultHeaders;
|
|
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
|
|
resp = await axios({
|
|
method: "POST",
|
|
url: "https://userload.co/api/request/",
|
|
data: body,
|
|
headers: headers
|
|
});
|
|
|
|
let dlLink = resp.data.split(`\t`).join(``).split(`\n`).join(``);
|
|
let dlName = $(".container.file-details > h3").text();
|
|
|
|
return {
|
|
axiosData: {
|
|
url: dlLink,
|
|
headers: {
|
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0",
|
|
"Accept": "video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5",
|
|
"Referer": url,
|
|
"Sec-Fetch-Dest": "video",
|
|
"Sec-Fetch-Mode": "no-cors",
|
|
"Sec-Fetch-Site": "cross-site",
|
|
}
|
|
},
|
|
metadata: {
|
|
fileName: dlName
|
|
}
|
|
};
|
|
} |