Last active
December 17, 2015 15:29
-
-
Save mappu/5632522 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Nyaaget (mappy 2013) | |
# Downloads torrents from nyaa and automatically adds them to transmission | |
# | |
# Usage: ./nyaaget "search terms" | |
# | |
# To run automatically every two hours: | |
# Run crontab -e to edit your user's crontab, and add a line like | |
# 0 */2 * * * /home/me/nyaaget/nyaaget.sh "Miya-k Miyakawa-ke no Kuufuku" | |
TORRENT_FILE_DIR=./ | |
if [ "$#" -ne 1 ] ; then | |
echo "Usage: $1 \"search terms\"" | |
exit 1 | |
fi | |
URLS=$( | |
curl -s "http://www.nyaa.eu/?page=rss&term=`echo "$1" | sed 's/ /+/g'`" |\ | |
grep -Eo "http://www.nyaa.eu/\?page=download[^<]*" |\ | |
sed 's/#38;//' | |
) | |
for url in $URLS ; do | |
TID=`echo "$url" | sed 's/.*tid=//'` | |
if [ ! -f ${TORRENT_FILE_DIR}nyaa_$TID.torrent ]; then | |
# Torrent file hasn't been downloaded before | |
curl -s "$url" > ${TORRENT_FILE_DIR}nyaa_$TID.torrent | |
#transmission-cli --download-dir "$DOWNLOAD_DEST" "nyaa_$TID.torrent" | |
transmission-remote -a "${TORRENT_FILE_DIR}nyaa_$TID.torrent" >/dev/null | |
fi | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment