Automatic send instance fetching (#174)

This commit is contained in:
BobIsMyManager 2022-04-09 09:19:13 +00:00 committed by GitHub
parent 8ae5a4092c
commit f56733ca03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 25 deletions

View File

@ -8,6 +8,7 @@ import searchHelper from "./search.js";
import translateHelper from "./translate/translate.js";
import wikipediaHelper from "./wikipedia.js";
import localise from '../localise.js'
import sendTargetsHelper from "./sendTargets.js";
function getRandomInstance(instances) {
return instances[~~(instances.length * Math.random())];
@ -22,6 +23,7 @@ async function wholeInit() {
await searchHelper.init();
await wikipediaHelper.init();
await mediumHelper.init();
await sendTargetsHelper.init();
}
async function updateInstances() {
@ -55,6 +57,8 @@ async function updateInstances() {
mediumHelper.setRedirects(instances.scribe);
sendTargetsHelper.setRedirects(instances.send);
console.info("Successfully updated Instances");
return true;
}

View File

@ -147,4 +147,4 @@ export default {
isException,
init,
}
}

View File

@ -10,23 +10,7 @@ const targets = [
let redirects = {
"send": {
"normal": [
"https://send.silkky.cloud",
"https://send.turingpoint.de",
"https://send.ephemeral.land",
"https://send.monks.tools",
"https://send.jeugdhulp.be",
"https://send.aurorabilisim.com",
"https://nhanh.cloud",
"https://send.datahoarder.dev",
"https://send.navennec.net",
"https://fileupload.ggc-project.de",
"https://drop.chapril.org",
"https://files.psu.ru",
"https://send.portailpro.net",
"https://bytefile.de",
"https://transfer.acted.org ",
],
"normal": [],
"tor": []
}
}
@ -35,7 +19,8 @@ const getRedirects = () => redirects;
const getCustomRedirects = function () {
return {
"send": {
"normal": [...sendNormalRedirectsChecks, ...sendNormalCustomRedirects]
"normal": [...sendNormalRedirectsChecks, ...sendNormalCustomRedirects],
"tor": [...sendTorRedirectsChecks, ...sendTorCustomRedirects]
},
};
};
@ -173,6 +158,7 @@ async function init() {
protocol = r.sendTargetsProtocol ?? "normal";
//redirects.send = dataJson.send;
if (r.sendTargetsRedirects) redirects = r.sendTargetsRedirects;
sendNormalRedirectsChecks = r.sendNormalRedirectsChecks ?? [...redirects.send.normal];

View File

@ -16,10 +16,10 @@
"https://inv.bp.mutahar.rocks",
"https://invidious.lunar.icu",
"https://invidious.mutahar.rocks",
"https://invidious.weblibre.org",
"https://invidious.esmailelbob.xyz",
"https://invidious.privacy.gd",
"https://invidious.esmailelbob.xyz",
"https://youtube.076.ne.jp",
"https://invidious.weblibre.org",
"https://invidious.namazso.eu"
],
"tor": [
@ -33,6 +33,26 @@
"http://2rorw2w54tr7jkasn53l5swbjnbvz3ubebhswscnc54yac6gmkxaeeqd.onion"
]
},
"send": {
"normal": [
"https://send.vis.ee",
"https://send.silkky.cloud",
"https://send.turingpoint.de",
"https://send.ephemeral.land",
"https://send.monks.tools",
"https://send.jeugdhulp.be",
"https://send.aurorabilisim.com",
"https://nhanh.cloud",
"https://send.datahoarder.dev",
"https://send.navennec.net",
"https://fileupload.ggc-project.de",
"https://drop.chapril.org",
"https://files.psu.ru",
"https://send.portailpro.net",
"https://bytefile.de",
"https://transfer.acted.org"
]
},
"nitter": {
"normal": [
"https://nitter.net",
@ -434,6 +454,7 @@
]
},
"peertube": [
"https://dalek.zone",
"https://video.sadmin.io",
"https://stream.jurnalfm.md",
"https://video.asgardius.company",
@ -509,7 +530,6 @@
"https://video.barcelo.cf",
"https://videotube.duckdns.org",
"https://peertube.1001solutions.net",
"https://peertube.razorserver.fr",
"https://tv.based.quest",
"https://peertube.beardedtek.com",
"https://casnocensure.site",
@ -975,7 +995,6 @@
"https://the.jokertv.eu",
"https://climatejustice.video",
"https://wikileaks.video",
"https://video.cnt.social",
"https://fair.tube",
"https://tube.lokad.com",
"https://videos.benjaminbrady.ie",
@ -1196,13 +1215,11 @@
"https://video.cigliola.com",
"https://xxx.noho.st",
"https://peertube.stefofficiel.me",
"https://video.eradicatinglove.xyz",
"https://canard.tube",
"https://videos.jordanwarne.xyz",
"https://tube.jeena.net",
"https://tube.cloud-libre.eu",
"https://videos.coletivos.org",
"https://peertube.nogafa.org",
"https://peertube.xwiki.com",
"https://tuvideo.encanarias.info",
"https://cinema.yunohost.support",

View File

@ -35,6 +35,16 @@ mightyList['invidious'] = invidiousList
print(Fore.GREEN + 'fetched ' + Style.RESET_ALL + 'Invidious')
# Send
r = requests.get('https://gitlab.com/timvisee/send-instances/-/raw/master/README.md')
tmp = re.findall(r"- ([-a-zA-Z0-9@:%_\+.~#?&//=]{2,}\.[a-z0-9]{2,}\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?)\)*\|*[A-Z]{0,}", r.text)
sendList = {}
sendList['normal'] = []
for item in tmp:
sendList['normal'].append(item)
mightyList['send'] = sendList
print('fetched Send')
# Nitter
r = requests.get('https://github.com/zedeus/nitter/wiki/Instances')
soup = BeautifulSoup(r.text, 'html.parser')