Last active
June 12, 2018 00:43
-
-
Save shreve/2ec1cae79426ee241b44b6296b003125 to your computer and use it in GitHub Desktop.
uTorrent add script
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
#!/usr/bin/env bash | |
# This script uses HTTPie, but could easily be adapted to use cURL. | |
# Change the host to be the location of your uTorrent server. | |
# Start this script and you'll get a prompt to paste in magnet links or links to torrent files | |
host=http://192.168.0.111:8080 | |
rpc=$host/gui/ | |
token="" | |
add_torrent() { | |
http --verbose \ | |
--session utorrent \ | |
GET $rpc \ | |
action==add-url \ | |
s=="$1" \ | |
token==$token | |
} | |
log_in() { | |
http --session utorrent --auth admin: GET ${rpc}web/index.html > /dev/null | |
token=$(http --session utorrent GET ${rpc}token.html | sed -E 's/<[^<>]+>//g') | |
} | |
log_in | |
while read -r -p 'add torrent -> ' link | |
do | |
add_torrent "$link" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment