repo: scrapers action: blob revision: path_from: tpb.sh revision_from: refs/heads/master: path_to: revision_to:
blob of:
/ tpb.sh
refs/heads/master:/tpb.sh
#!/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