Created
November 20, 2013 18:10
-
-
Save glpunk/7568086 to your computer and use it in GitHub Desktop.
Automatic torrent download from glowgaze.com with transmission-remote (raspberry pi)
This file contains hidden or 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 | |
#save HTML content to file.html | |
curl -o /tmp/file.html http://glowgaze.com/ | |
#search by grep content in file.html | |
function get { | |
arr=(`cat /tmp/file.html | grep -o -E '(goto-+([0-9]*-)('$1')(\w)*)'`) | |
echo ${arr[0]} | |
if grep -Fxq ${arr[0]} /home/pi/downloaded.log | |
then | |
echo 'already downloaded' | |
else | |
echo ${arr[0]} >> /home/pi/downloaded.log | |
#getting torrent web page | |
curl --location "http://glowgaze.com/${arr[0]}" -o /tmp/file2.html | |
#searching magnet link | |
arr=(`cat /tmp/file2.html | grep -o -E '(magnet:+\?(\w(=?:?&?;?\+?%?\.?))*)'`) | |
if [[ ${arr[0]} =~ magnet ]]; then | |
transmission-remote -n transuser:transpass -a ${arr[0]/amp;/} | |
fi | |
fi | |
} | |
get "The-Walking-Dead-" | |
get "Homeland-" | |
get "Hostages-" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment