Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #************************************************#
- # автор: [email protected] #
- # Ноябрь , 2012 #
- # #
- # Скачиваем 20 фильмов rutracker.org #
- # с наиб. кол-м сидов #
- #************************************************#
- TR_HOST="rutracker.org"
- TR_USER="CasperGreen"
- TR_PASSWORD="i_love_money"
- DIR="/mnt/FILMS"
- SC_COOKIE="/tmp/gt-$TR_HOST-$TR_USER.ck"
- SC_UA="Mozilla/5.0 (X11; U; Linux x86_64; ru; rv:1.9.2.15) Gecko/20110303 Ubuntu/10.10 (maverick) Firefox/3.6.15"
- echo "---Cheking auth"
- if [ -w $SC_COOKIE ]; then
- aut_page="`curl -b $SC_COOKIE -c $SC_COOKIE -A "$SC_UA" "http://rutracker.org/forum/index.php"`"
- # echo "$aut_page" > aut_page.html
- result=`echo "$aut_page" | egrep -o "$TR_USER"`
- fi
- echo "---$result";
- sleep 1
- if [ -z "$result" ]; then
- echo "---Makin auth";
- autpath="http://login.rutracker.org/forum/login.php";
- if [ -w $SC_COOKIE ]; then
- cookie_data=`cat $SC_COOKIE`
- curl --trace-ascii - -b $SC_COOKIE -c $SC_COOKIE -A "$SC_UA" -d "login_username=$TR_USER" \
- -d "login_password=$TR_PASSWORD" --data-binary "login=%C2%F5%EE%E4" "$autpath">/dev/null
- else
- curl --trace-ascii - -c $SC_COOKIE -A "$SC_UA" -d "login_username=$TR_USER" \
- -d "login_password=$TR_PASSWORD" --data-binary "login=%C2%F5%EE%E4" "$autpath">123.html
- fi
- fi
- sleep 1
- echo "get list_id"
- tracker_page="`curl -b $SC_COOKIE -c $SC_COOKIE -A "$SC_UA" -d "o=10" -d "s=2" "http://rutracker.org/forum/tracker.php"`"
- echo "$tracker_page" > /tmp/tracker_page.html
- list_id=`echo "$tracker_page" | \
- tr -d "\n" | iconv -t utf8 -f cp1251 | \
- grep -P -o '<tr .*?</tr>' | egrep -i "Фильмы" | egrep -i "проверено" | \
- grep -P -o '(?<=dl.php\?t=)[0-9]*' | head -n 20`
- echo -e "---List_id:\n$list_id";
- if [ -z "$list_id" ]; then
- echo "--Parsing error!"
- exit
- fi
- rm -rf /tmp/\[rutracker.org\].t*
- rm -f "$DIR/*.aria2"
- echo "Downloading .torrent-files"
- for id in $list_id
- do
- echo "---Loading $id"
- curl --cookie "bb_dl=$id" -b $SC_COOKIE -c $SC_COOKIE -A "$SC_UA" -o "/tmp/[rutracker.org].t$id.torrent" \
- -e "http://rutracker.org/forum/viewtopic.php?t=$id" "http://dl.rutracker.org/forum/dl.php?t=$id"
- done
- #loading 2GIS.Irkutsk
- curl -s irkutsk.2gis.ru | grep -P -o "http://download.2gis.ru/arhives/2GISShell.*?\.exe" | xargs wget -cP /mnt/ALL/\!Софт/
- find /mnt/ALL/\!Софт/2GIS* | sort | sed -n 2,+99p | xargs rm -f #delete old versions
- echo "Delete old torrents"
- cat /tmp/\[rutracker.org\].t* | \
- grep -aPo "(?<=4:name)[0-9]+:.*?(?=[0-9]+:)" | \
- sed "s/\([0-9]*\):\(.*\)/\2/" > /tmp/newtorrentfiles.txt
- ls -t1 "$DIR" > /tmp/torrentfiles.txt
- grep -v --file=/tmp/newtorrentfiles.txt /tmp/torrentfiles.txt | \
- while read file; do rm -rf "$DIR/$file"; done;
- #screen -d -m -L
- aria2c --no-conf --seed-time=0 --bt-max-peers=5 -V -j20 -d "$DIR" /tmp/\[rutracker.org\]*
Advertisement
Add Comment
Please, Sign In to add comment