mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-13 03:18:07 +01:00
Refactor code :3
This commit is contained in:
parent
a3d4a07875
commit
b149d3e365
1 changed files with 24 additions and 8 deletions
|
@ -19,7 +19,8 @@ const fetcher = require("../libpoketube/libpoketube-fetcher.js");
|
||||||
const getColors = require("get-image-colors");
|
const getColors = require("get-image-colors");
|
||||||
|
|
||||||
const wiki = require("wikipedia");
|
const wiki = require("wikipedia");
|
||||||
const sqp = "-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw";
|
const sqp =
|
||||||
|
"-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw";
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
tubeApi: "https://tube-srv.ashley143.gay/api/",
|
tubeApi: "https://tube-srv.ashley143.gay/api/",
|
||||||
|
@ -70,6 +71,7 @@ async function video(v) {
|
||||||
|
|
||||||
let nightlyRes;
|
let nightlyRes;
|
||||||
var desc = "";
|
var desc = "";
|
||||||
|
var iurl = "invidious.privacydev.net";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var inv_comments = await fetch(`${config.invapi}/comments/${v}`).then(
|
var inv_comments = await fetch(`${config.invapi}/comments/${v}`).then(
|
||||||
|
@ -80,16 +82,30 @@ async function video(v) {
|
||||||
} catch {
|
} catch {
|
||||||
var comments = "";
|
var comments = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const urls = [
|
||||||
|
"invidious.sethforprivacy.com",
|
||||||
|
"invidious.weblibre.org",
|
||||||
|
"inv.vern.cc"
|
||||||
|
];
|
||||||
|
|
||||||
try {
|
let vid;
|
||||||
var video_new_info = await fetch(`https://invidious.privacydev.net/api/v1/videos/${v}`).then(
|
|
||||||
(res) => res.text()
|
|
||||||
);
|
|
||||||
|
|
||||||
var vid = await getJson(video_new_info);
|
for (const url of urls) {
|
||||||
} catch {
|
const videoInfo = await fetch(`https://${url}/api/v1/videos/${v}`).then(res => res.text());
|
||||||
var vid = "";
|
vid = await getJson(videoInfo);
|
||||||
|
|
||||||
|
if (vid.descriptionHtml !== "<p></p>") {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!vid) {
|
||||||
|
// Handle error case
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (checkUnexistingObject(vid)) {
|
if (checkUnexistingObject(vid)) {
|
||||||
var a;
|
var a;
|
||||||
|
|
Loading…
Reference in a new issue