__ _ __ _ _ __ ______\ \_\\_______________________\///__________________________//_/ /______ \___\ /___/ | .__ __ | | | ___ __________/ |________ | | \ \/ / ____/\ __\_ __ \ | ; > < <_| | | | | | \/ ; : /__/\_ \__ | |__| |__| : . \/ |__| . . . : H/Q Another Droid BBS - andr01d.zapto.org:9999 : ; ; + --- -- - . - --- --- --- - . - -- --- + : : | torrentz part ii | : : ` --- -- - . - --- --- --- - . - -- --- ' In the previous issue i posted a script for downloading torrent files to a BBS. I made some additions to that so, i am posting it here to be available for others too. The new stuff is that we delete torrent files that are older than a specific amount of days ex: 7. This way, we only keep "fresh" torrents, which have more seeders, as we only get the top100 of them. Also we add some info for the torrent, like seeders, leechers and file size. To accomplish that, i used this trick. I placed each torrent file into an archive and created a file_id.diz that contains the info. This way, in any bbs system, the torrent will display also the file_id.diz and the user will have some idea of the original file size, seeders etc. We could also add the description of the torrent, from TPB, but i tried with mixed results. The site uses UTF8 encoding, but many BBSes use CP437. A conversion from UTF8 to CP437 is not always succesfull, so i got some weird results, that made the bbs server to kick the users who viewed those files. If you use a UTF8 system, perhaps it will work for you. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #!/bin/bash #Use a valid address. Check https://piratebay-proxylist.se/ for new ones. prt="https://unblocktheship.org" #Check https://unblocktheship.org/top to get area numbers areas=$'201\n205\n101\n301\n306' #Edit this to your torrents root folder. root="/home/$(whoami)/mystic/files/torrentz" echo "Deleting Files older than 7 days..." find /home/pi/mystic/files/torrentz/ -type f -mtime +7 -name '*.zip' \ -execdir rm -- '{}' \; while read -r area; do mkdir -p $root/$area sleep 2s echo "Getting Area: $area" curl -s $prt/top/$area > /tmp/tmp.htm #iconv -f utf8 -t cp437 /tmp/tmp.htm > /tmp/tmp2.htm #rm /tmp/tmp.htm #mv /tmp/tmp2.htm /tmp/tmp.htm page="$(cat /tmp/tmp.htm)" links="$(cat /tmp/tmp.htm | grep "