mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-22 17:57:52 +01:00
remove bloat
This commit is contained in:
parent
a82ee1daf0
commit
df21981d44
1 changed files with 19 additions and 53 deletions
|
@ -20,21 +20,13 @@ 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://inner-api.poketube.fun/api/",
|
||||
invapi: "https://invid-api.poketube.fun/api/v1",
|
||||
dislikes: "https://returnyoutubedislikeapi.com/votes?videoId=",
|
||||
t_url: "https://t.poketube.fun/", // def matomo url
|
||||
};
|
||||
|
||||
function initerr(args){
|
||||
console.error("[LIBPT CORE ERROR]" + args)
|
||||
}
|
||||
|
||||
|
||||
// Util functions
|
||||
|
||||
/*
|
||||
* Api functions
|
||||
*/
|
||||
function getJson(str) {
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
|
@ -51,27 +43,19 @@ function checkUnexistingObject(obj) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Api functions
|
||||
*/
|
||||
|
||||
async function channel(id, cnt) {
|
||||
if (id == null) return "Gib ID";
|
||||
|
||||
const videos = await fetch(
|
||||
`${config.tubeApi}channel?id=${id}&tab=videos&continuation=${cnt || ""}`
|
||||
)
|
||||
.then((res) => res.text())
|
||||
.then((xml) => getJson(toJson(xml)));
|
||||
|
||||
const about = await fetch(`${config.tubeApi}channel?id=${id}&tab=about`)
|
||||
.then((res) => res.text())
|
||||
.then((xml) => getJson(toJson(xml)));
|
||||
|
||||
return { videos, about };
|
||||
}
|
||||
|
||||
const cache = {};
|
||||
const sqp = "-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw";
|
||||
|
||||
const config = {
|
||||
tubeApi: "https://inner-api.poketube.fun/api/",
|
||||
invapi: "https://invid-api.poketube.fun/api/v1",
|
||||
dislikes: "https://returnyoutubedislikeapi.com/votes?videoId=",
|
||||
t_url: "https://t.poketube.fun/", // def matomo url
|
||||
};
|
||||
|
||||
function initerr(args){
|
||||
console.error("[LIBPT CORE ERROR]" + args)
|
||||
}
|
||||
|
||||
async function video(v) {
|
||||
if (v == null) return "Gib ID";
|
||||
|
@ -82,7 +66,6 @@ async function video(v) {
|
|||
return cache[v].result;
|
||||
}
|
||||
|
||||
let nightlyRes;
|
||||
var desc = "";
|
||||
|
||||
try {
|
||||
|
@ -127,13 +110,9 @@ async function video(v) {
|
|||
var a = "";
|
||||
}
|
||||
|
||||
|
||||
desc = a.Channel?.Contents?.ItemSection?.About?.Description;
|
||||
|
||||
const fe = await fetcher(v);
|
||||
|
||||
const nightlyJsonData = getJson(nightlyRes);
|
||||
|
||||
try {
|
||||
|
||||
const summary = await wiki
|
||||
|
@ -177,17 +156,6 @@ async function video(v) {
|
|||
}
|
||||
}
|
||||
|
||||
async function search(query, cnt) {
|
||||
if (query == null) return "Gib Query";
|
||||
|
||||
const data = await fetch(
|
||||
`${config.tubeApi}search?query=${query}&continuation=${cnt || ""}`
|
||||
)
|
||||
.then((res) => res.text())
|
||||
.then((xml) => getJson(toJson(xml)));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
async function isvalidvideo(v) {
|
||||
if (v != "assets") {
|
||||
|
@ -198,8 +166,6 @@ async function isvalidvideo(v) {
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
search,
|
||||
video,
|
||||
isvalidvideo,
|
||||
channel,
|
||||
isvalidvideo
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue