kuzyara

rutr.sh

Nov 6th, 2012
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.00 KB | None | 0 0
  1. #!/bin/bash
  2. #************************************************#
  3. #         автор: [email protected]            #
  4. #                Ноябрь  , 2012                  #
  5. #                                                #
  6. #      Скачиваем 20 фильмов rutracker.org        #
  7. #            с наиб. кол-м сидов                 #
  8. #************************************************#
  9.  
  10. TR_HOST="rutracker.org"
  11. TR_USER="CasperGreen"
  12. TR_PASSWORD="i_love_money"
  13. DIR="/mnt/FILMS"
  14.  
  15. SC_COOKIE="/tmp/gt-$TR_HOST-$TR_USER.ck"
  16. 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"
  17.  
  18.  
  19. echo "---Cheking auth"
  20. if [ -w $SC_COOKIE ]; then
  21.     aut_page="`curl -b $SC_COOKIE  -c $SC_COOKIE -A "$SC_UA" "http://rutracker.org/forum/index.php"`"
  22. #   echo "$aut_page" > aut_page.html
  23.     result=`echo "$aut_page" | egrep -o "$TR_USER"`
  24. fi
  25. echo "---$result";
  26. sleep 1
  27.  
  28.  
  29. if [ -z "$result" ]; then
  30.     echo "---Makin auth";
  31.     autpath="http://login.rutracker.org/forum/login.php";
  32.     if [ -w $SC_COOKIE ]; then
  33.     cookie_data=`cat $SC_COOKIE`
  34.     curl --trace-ascii - -b $SC_COOKIE  -c $SC_COOKIE -A "$SC_UA" -d "login_username=$TR_USER" \
  35.         -d "login_password=$TR_PASSWORD" --data-binary "login=%C2%F5%EE%E4"  "$autpath">/dev/null
  36.     else
  37.     curl --trace-ascii - -c $SC_COOKIE -A "$SC_UA" -d "login_username=$TR_USER" \
  38.         -d "login_password=$TR_PASSWORD" --data-binary "login=%C2%F5%EE%E4"  "$autpath">123.html
  39.     fi
  40. fi
  41. sleep 1
  42.  
  43.  
  44. echo "get list_id"
  45. tracker_page="`curl  -b $SC_COOKIE -c $SC_COOKIE -A "$SC_UA" -d "o=10" -d "s=2"     "http://rutracker.org/forum/tracker.php"`"
  46. echo "$tracker_page" > /tmp/tracker_page.html
  47. list_id=`echo "$tracker_page" | \
  48.     tr -d "\n" | iconv -t utf8 -f cp1251 | \
  49.     grep -P -o '<tr .*?</tr>' | egrep -i "Фильмы" | egrep -i "проверено" | \
  50.     grep -P -o '(?<=dl.php\?t=)[0-9]*' | head -n 20`
  51. echo -e "---List_id:\n$list_id";
  52. if [ -z "$list_id" ]; then
  53.     echo "--Parsing error!"
  54.     exit
  55. fi
  56.  
  57.  
  58. rm -rf /tmp/\[rutracker.org\].t*   
  59. rm -f "$DIR/*.aria2"
  60.  
  61. echo "Downloading .torrent-files"
  62. for id in $list_id
  63. do
  64. echo "---Loading $id"
  65. curl --cookie "bb_dl=$id" -b $SC_COOKIE -c $SC_COOKIE -A "$SC_UA" -o "/tmp/[rutracker.org].t$id.torrent"  \
  66.     -e "http://rutracker.org/forum/viewtopic.php?t=$id" "http://dl.rutracker.org/forum/dl.php?t=$id"
  67. done
  68.  
  69. #loading 2GIS.Irkutsk
  70. curl -s irkutsk.2gis.ru | grep -P -o "http://download.2gis.ru/arhives/2GISShell.*?\.exe" | xargs wget -cP /mnt/ALL/\!Софт/
  71. find /mnt/ALL/\!Софт/2GIS* | sort | sed -n 2,+99p | xargs rm -f #delete old versions
  72.  
  73. echo "Delete old torrents"
  74. cat /tmp/\[rutracker.org\].t* | \
  75.     grep -aPo "(?<=4:name)[0-9]+:.*?(?=[0-9]+:)" | \
  76.     sed "s/\([0-9]*\):\(.*\)/\2/" > /tmp/newtorrentfiles.txt
  77. ls -t1 "$DIR" > /tmp/torrentfiles.txt
  78. grep -v --file=/tmp/newtorrentfiles.txt /tmp/torrentfiles.txt | \
  79.     while read file; do rm -rf "$DIR/$file"; done;
  80.  
  81. #screen -d -m -L
  82. 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