i couldnt care less
This commit is contained in:
parent
93513c8a71
commit
a609dcef99
1 changed files with 12 additions and 2 deletions
14
index.js
14
index.js
|
@ -23,9 +23,19 @@ app.get("/*/status/*", async (req, res) => {
|
||||||
let target =
|
let target =
|
||||||
config.FUCKING_ENDPOINT +
|
config.FUCKING_ENDPOINT +
|
||||||
encodeURIComponent(config.TWITTER_BASE_URL + req.url.slice(1));
|
encodeURIComponent(config.TWITTER_BASE_URL + req.url.slice(1));
|
||||||
let twitter_res = await fetch(target);
|
let twitter_res;
|
||||||
|
try {
|
||||||
|
twitter_res = await fetch(target);
|
||||||
|
} catch (err) {
|
||||||
|
returnres.status(502).send(err.message);
|
||||||
|
}
|
||||||
if (twitter_res.status == 200) {
|
if (twitter_res.status == 200) {
|
||||||
let body = await twitter_res.json();
|
let body;
|
||||||
|
try {
|
||||||
|
body = await twitter_res.json();
|
||||||
|
} catch (err) {
|
||||||
|
return res.status(502).send(err.message);
|
||||||
|
}
|
||||||
let html = parse(body.html);
|
let html = parse(body.html);
|
||||||
let block = html.firstChild;
|
let block = html.firstChild;
|
||||||
let content = block.childNodes[0].innerText;
|
let content = block.childNodes[0].innerText;
|
||||||
|
|
Loading…
Reference in a new issue