31 lines
784 B
JavaScript
31 lines
784 B
JavaScript
const rp = require("request-promise");
|
|
const cheerio = require("cheerio");
|
|
const { exec } = require("child_process");
|
|
const fs = require("fs");
|
|
const url = "https://rentry.org/firehawk52#deezer";
|
|
|
|
exec("rm ../config/login.json", (error, stdout, stderr) => {});
|
|
|
|
rp(url).then(function (html) {
|
|
const $ = cheerio.load(html);
|
|
arl = null;
|
|
|
|
$("table.ntable:nth-of-type(1) > tbody")
|
|
.find("tr")
|
|
.each(function () {
|
|
if ($("td", this).html().includes("Canada")) {
|
|
arl = $("td:nth-child(4) > code", this).text();
|
|
}
|
|
});
|
|
|
|
outputJson = {
|
|
"accessToken": null,
|
|
'arl': arl,
|
|
}
|
|
|
|
fs.writeFile("../config/login.json", JSON.stringify(outputJson), (err) => {
|
|
if (err) {
|
|
console.error(err);
|
|
}
|
|
});
|
|
}); |