1
0
Fork 0
mirror of https://codeberg.org/ashley/poke.git synced 2024-11-17 11:14:38 -05:00

update stuff :p

This commit is contained in:
Ashley 2023-01-26 09:24:22 +00:00
parent ca9377a19a
commit 73e1b79a5b

View file

@ -19,6 +19,8 @@ const fetcher = require("../libpoketube/libpoketube-fetcher.js");
const getColors = require("get-image-colors");
const wiki = require("wikipedia");
const sqp =
"-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw";
const config = {
tubeApi: "https://tube-srv.ashley143.gay/api/",
@ -69,6 +71,7 @@ async function video(v) {
let nightlyRes;
var desc = "";
try {
var inv_comments = await fetch(`${config.invapi}/comments/${v}`).then(
(res) => res.text()
@ -78,6 +81,7 @@ async function video(v) {
} catch {
var comments = "";
}
try {
var video_new_info = await fetch(`${config.invapi}/videos/${v}`).then(
(res) => res.text()
@ -114,7 +118,7 @@ async function video(v) {
const nightlyJsonData = getJson(nightlyRes);
return {
json: data.video.Player,
json: data?.video?.Player,
video: await fetch(`${config.tubeApi}video?v=${v}`)
.then((res) => res.text())
.then((xml) => getJson(toJson(xml))),
@ -124,10 +128,10 @@ async function video(v) {
wiki: summary,
desc: desc,
color: await getColors(
`https://i.ytimg.com/vi/${v}/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw`
`https://i.ytimg.com/vi/${v}/hqdefault.jpg?sqp=${sqp}`
).then((colors) => colors[0].hex()),
color2: await getColors(
`https://i.ytimg.com/vi/${v}/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw`
`https://i.ytimg.com/vi/${v}/hqdefault.jpg?sqp=${sqp}`
).then((colors) => colors[1].hex()),
};
}