#!/bin/sh
#author:Wos
#a script to test invidious instance available
ivlist="invi.susurrando.com compilations.broquemonsieur.net invidious.adminforge.de invidious.bachgau.social invidious.darkness.services invidious.drgns.space invidious.drivet.xyz invidious.einfachzocken.eu invidious.ethibox.fr invidious.fdn.fr invidious.flokinet.to invidious.frbin.com invidious.hyperreal.coffee invidious.incogniweb.net invidious.io.lol invidious.jing.rocks invidious.materialio.us invidious.nerdvpn.de invidious.nirn.quest invidious.perennialte.ch invidious.privacydev.net invidious.privacyredirect.com invidious.protokolla.fi invidious.pufe.org invidious.qwik.space invidious.reallyaweso.me invidious.ritoge.com invidious.varishangout.net invidious.yourdevice.ch invidious.zapashcanon.fr inv.in.projectsegfau.lt inv.n8pjl.ca inv.nadeko.net inv.odyssey346.dev inv.shg.wtf inv.tux.pizza inv.us.projectsegfau.lt iteroni.com iv.catgirl.cloud iv.datura.network iv.ggtyler.dev iv.melmac.space iv.nboeck.de iv.nowhere.moe iv.ok0.org monocles.live vid.lilay.dev vid.selbsthilfegruppe.wtf www.youchu.be yewtu.be y.hc.ws youchu.be youtube.076.ne.jp youtube.alt.tyil.nl youtube.privacyplz.org yt.artemislena.eu yt.drgnz.club yt.pwnwriter.xyz"
echo ${ivlist}|tr ' ' '\n'|awk '{print "https://"$1"/search?q=flat+earth"}'|nl|awk '{print $2"\n out="$1".html"}' > /tmp/invtest.txt
echo ${ivlist}|tr ' ' '\n' > /tmp/invtest2.txt
rm /tmp/invtest/* 2>/dev/null
aria2c --all-proxy="http://127.0.0.1:7891" --input-file=/tmp/invtest.txt --dir=/tmp/invtest/ --connect-timeout=3 --allow-overwrite=true -x8 -s8 -k 1M
ls -1 /tmp/invtest/*|xargs -I {} sh -c 'cat {}|grep earth >/dev/null && echo {}'|awk -F\/ '{print $4}'|awk -F. '{print $1}'|xargs -I {} sh -c 'cat /tmp/invtest2.txt|sed -n {}p'|awk '{print "<p class=\"center\"><a href=\"https://"$1"\">https://"$1"</a></p>"}'