-- Leo's gemini proxy
-- Connecting to git.thebackupbox.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
repo: scrapers action: commit revision: path_from: revision_from: a7cfb367008a829b6a51e426615c9b84775c437a: path_to: revision_to:
commit a7cfb367008a829b6a51e426615c9b84775c437a Author: epoch <epoch@hack.thebackupbox.net> Date: Tue Oct 19 06:18:03 2021 +0000 cleaned up urbidct's output a bit, created this git repo, Makefile, and copied tpb.sh in diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..249e48d9dcc8640b9afd4d90075e8ba06f4e8926 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +PREFIX:=/usr/local + +.PHONEY: install + +all: + +install: + install -t $(PREFIX)/bin urbdict.sh + install -t $(PREFIX)/bin tpb.sh diff --git a/tpb.sh b/tpb.sh new file mode 100755 index 0000000000000000000000000000000000000000..f669b8be20946841139e05520622031a056626f0 --- /dev/null +++ b/tpb.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +### translated from: +encodeURIComponent() { + uriescape "$1" | html_entities_encode +} + +print_trackers() { + printf '&tr=%s' $(encodeURIComponent 'udp://tracker.coppersurfer.tk:6969/announce') + printf '&tr=%s' $(encodeURIComponent 'udp://tracker.openbittorrent.com:6969/announce') + printf '&tr=%s' $(encodeURIComponent 'udp://tracker.opentrackr.org:1337') + printf '&tr=%s' $(encodeURIComponent 'udp://tracker.leechers-paradise.org:6969/announce') + printf '&tr=%s' $(encodeURIComponent 'udp://tracker.dler.org:6969/announce') + printf '&tr=%s' $(encodeURIComponent 'udp://opentracker.i2p.rocks:6969/announce') + printf '&tr=%s' $(encodeURIComponent 'udp://47.ip-51-68-199.eu:6969/announce') +} + +print_magnet() { + ih=$1 + shift + name="$*" + printf 'magnet:?xt=urn:btih:%s&dn=%s%s\n' "${ih}" "$(encodeURIComponent "${name}")" "$(print_trackers)" +} + +#get magnets based on search. easy. :P +if [ "_$1" = "_" ];then + printf "usage: tpb.sh query\n" + exit 1 +else + if [ "_$2" = "_" ];then + cat=0 + else + cat="$2" + fi + if [ "_$3" = "_" ];then + lim=5 + else + lim="$3" + fi + wget -qO- "http://piratebayztemzmv.onion/q.php?q=${1}&cat=0" \ + | jq -r '.[] | .info_hash, .name' | paste - - | while read line;do + print_magnet $line +done +# | tr '"' "\n" \ +# | grep ^magnet \ +# | html_entities_decode \ +# | head -n "$lim" +fi diff --git a/urbdict.sh b/urbdict.sh new file mode 100755 index 0000000000000000000000000000000000000000..92148a5eae263fb80177911b5cd43cf2140dae8e --- /dev/null +++ b/urbdict.sh @@ -0,0 +1,8 @@ +wget -A Mozilla -qO- "https://www.urbandictionary.com/define.php?term=$(uriescape "$@")" \ + | tr -d '\n' 2>/dev/null \ + | tr '<' '\n' 2>/dev/null \ + | XuntilY '^div class="meaning"' '^/div' \ + | sed 's/^.*>//g' \ + | sed -z 's/\n//g' \ + | sed 's/\./.\n/g' \ + | html_entities_decode
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 16:54:59 2024