mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-26 04:38:56 +01:00
add video proxys :3
This commit is contained in:
parent
be55c7e5ec
commit
2d94f2abe1
1 changed files with 55 additions and 57 deletions
|
@ -1,14 +1,14 @@
|
||||||
/*
|
/*
|
||||||
|
|
||||||
PokeTube is a Free/Libre youtube front-end !
|
PokeTube is a Free/Libre YouTube front-end !
|
||||||
|
|
||||||
Copyright (C) 2021-2023 POKETUBE
|
Copyright (C) 2021-2023 POKETUBE
|
||||||
|
|
||||||
This file is Licensed under LGPL-3.0-or-later. Poketube itself is GPL, Only this file is LGPL.
|
This file is Licensed under LGPL-3.0-or-later. PokeTube itself is GPL, Only this file is LGPL.
|
||||||
|
|
||||||
see a copy here:https://www.gnu.org/licenses/lgpl-3.0.txt
|
See a copy here: https://www.gnu.org/licenses/lgpl-3.0.txt
|
||||||
|
|
||||||
please dont remove this comment while sharing this code
|
Please don't remove this comment while sharing this code
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -33,8 +33,7 @@ const {
|
||||||
getRandomArbitrary,
|
getRandomArbitrary,
|
||||||
} = require("./ptutils/libpt-coreutils.js");
|
} = require("./ptutils/libpt-coreutils.js");
|
||||||
|
|
||||||
module.exports = async function (video_id) {
|
// Function to convert an array to an object, ignoring undefined values
|
||||||
// function to convert an array to an object, ignoring undefined values
|
|
||||||
function toObject(arr) {
|
function toObject(arr) {
|
||||||
return arr.reduce((acc, cur, i) => {
|
return arr.reduce((acc, cur, i) => {
|
||||||
if (cur !== undefined) {
|
if (cur !== undefined) {
|
||||||
|
@ -44,32 +43,30 @@ module.exports = async function (video_id) {
|
||||||
}, {});
|
}, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets invidious instances
|
// Gets Invidious instances
|
||||||
const invInstanceList = require("./invapi.json");
|
const invInstanceList = [
|
||||||
|
{ uri: "https://invidious.projectsegfau.lt" },
|
||||||
|
{ uri: "https://iv.ggtyler.dev" },
|
||||||
|
{ uri: "https://invidious.protokolla.fi" },
|
||||||
|
{ uri: "https://inv.zzls.xyz" },
|
||||||
|
{ uri: "https://invidious.fdn.fr" },
|
||||||
|
{ uri: "https://anontube.lvkaszus.pl" },
|
||||||
|
{ uri: "https://iv.datura.network" },
|
||||||
|
{ uri: "https://yt.drgnz.club" },
|
||||||
|
{ uri: "https://invidious.private.coffee" },
|
||||||
|
{ uri: "https://inv.tux.pizza" },
|
||||||
|
{ uri: "https://invidious.lunar.icu" },
|
||||||
|
{ uri: "https://yt.artemislena.eu" },
|
||||||
|
];
|
||||||
|
|
||||||
// gets random instances from the list
|
// Gets a random instance from the list
|
||||||
const instance =
|
const instance = invInstanceList[Math.floor(Math.random() * invInstanceList.length)];
|
||||||
invInstanceList[Math.floor(Math.random() * invInstanceList.length)];
|
|
||||||
|
|
||||||
let url;
|
let url;
|
||||||
if (instance[1].type != "https") {
|
if (instance.uri.startsWith("https://")) {
|
||||||
url = "https://tube.kuylar.dev";
|
url = instance.uri;
|
||||||
} else {
|
} else {
|
||||||
//replaces bad proxys (e.g the proxys that do not support media proxys, or the proxys that are down )
|
url = "https://tube.kuylar.dev";
|
||||||
url = instance[1].uri
|
|
||||||
.replace("invidious.tiekoetter.com", "inv.odyssey346.dev")
|
|
||||||
.replace("invidious.slipfox.xyz", "y.com.sb")
|
|
||||||
.replace("yewtu.be", "y.com.sb")
|
|
||||||
.replace("iv.melmac.space", "inv.vern.cc")
|
|
||||||
.replace("yt.oelrichsgarcia.de", "y.com.sb")
|
|
||||||
.replace("yt.funami.tech", "y.com.sb")
|
|
||||||
.replace("invidious.lidarshield.cloud", "inv.odyssey346.dev")
|
|
||||||
.replace("vid.priv.au", "inv.vern.cc")
|
|
||||||
.replace("invidious.privacydev.net", "tube.kuylar.dev")
|
|
||||||
.replace("watch.thekitty.zone", "y.com.sb")
|
|
||||||
.replace("invidious.snopyta.org", "inv.odyssey346.dev")
|
|
||||||
.replace("invidious.weblibre.org", "y.com.sb")
|
|
||||||
.replace("invidious.sethforprivacy.com", "y.com.sb")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const isInvidiousURL = url === "https://tube.kuylar.dev" ? false : true;
|
const isInvidiousURL = url === "https://tube.kuylar.dev" ? false : true;
|
||||||
|
@ -78,8 +75,9 @@ module.exports = async function (video_id) {
|
||||||
isInvidiousURL,
|
isInvidiousURL,
|
||||||
cacheBuster: "d0550b6e28c8f93533a569c314d5b4e2",
|
cacheBuster: "d0550b6e28c8f93533a569c314d5b4e2",
|
||||||
InvidiousPoketube: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",
|
InvidiousPoketube: "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8",
|
||||||
url:"https://vid.theedgeofrage.com" // set for now : see https://github.com/iv-org/invidious/issues/4045
|
url: url, // set for now: see https://github.com/iv-org/invidious/issues/4045
|
||||||
}
|
};
|
||||||
|
|
||||||
|
module.exports = async function (video_id) {
|
||||||
return videoProxyObject;
|
return videoProxyObject;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue