ok maybe a little
This commit is contained in:
parent
a609dcef99
commit
501768a31d
1 changed files with 7 additions and 2 deletions
9
index.js
9
index.js
|
@ -1,6 +1,7 @@
|
|||
import express from "express";
|
||||
import logRequest from "./logger.js";
|
||||
import { parse } from "node-html-parser";
|
||||
import { format } from "util";
|
||||
|
||||
const config = {
|
||||
FUCKING_ENDPOINT:
|
||||
|
@ -27,14 +28,18 @@ app.get("/*/status/*", async (req, res) => {
|
|||
try {
|
||||
twitter_res = await fetch(target);
|
||||
} catch (err) {
|
||||
returnres.status(502).send(err.message);
|
||||
return res
|
||||
.status(502)
|
||||
.send("Error from Twitter API: " + format("%s", err));
|
||||
}
|
||||
if (twitter_res.status == 200) {
|
||||
let body;
|
||||
try {
|
||||
body = await twitter_res.json();
|
||||
} catch (err) {
|
||||
return res.status(502).send(err.message);
|
||||
return res
|
||||
.status(502)
|
||||
.send("Error from Twitter API: " + format("%s", err));
|
||||
}
|
||||
let html = parse(body.html);
|
||||
let block = html.firstChild;
|
||||
|
|
Loading…
Reference in a new issue