LAPINPT

rutracker rss feed

Apr 30th, 2016
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.51 KB | None | 0 0
  1. #! /bin/bash
  2.  
  3. trCMD="transmission-remote localhost:9091 -n USER:PASS"
  4. WDIR='/home/USER/public/transmission'
  5. ruLog='/home/USER/jobs/katLog.txt'
  6. atURL='http://feed.rutracker.org/atom/f/1087.atom'
  7.  
  8. uAgent='User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:45.0) Gecko/20100101 Firefox/45.0'
  9. aceptX='Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
  10. aceptL='Accept-Language: pt-PT,pt;q=0.8,en;q=0.5,en-US;q=0.3'
  11. keepA='Connection: keep-alive'
  12.  
  13. ruFeed () { DELAY; curl -sm10 "$atURL" -H 'Host: feed.rutracker.org' -H "$uAgent" -H "$aceptX" -H "$aceptL" -H "$keepA"; }
  14. ScraP () { DELAY; curl -sm10 "$ruTpic" -H 'Host: rutracker.org' -H "$uAgent" -H "$aceptX" -H "$aceptL" -H "$keepA"; }
  15. dFiltR () { urlencode -d "$(egrep -o 'magnet:.*[0-9A-F]{40}.*3Fmagnet' <<< "$ruScrap")"; }
  16. DELAY () { sleep `shuf -i 3-9 -n 1`; }
  17. myDMin() { echo `date +"%d%#b  %R"`; }
  18.  
  19. while :; do
  20.  
  21.     while read ruRSS; do
  22.         ruTpic="${ruRSS##* }"; viewt="${ruTpic##*\?}"
  23.         fRLS="${ruRSS%% *}" ; ruRLS="${fRLS//\//.}"
  24.         [[ $ruRLS =~ ^(http:|<.xml) ]] && continue
  25.         #[[ ! $ruRLS =~ ^SolidWorks.*SP ]] && continue
  26.         grep -q " $viewt " "$ruLog" && continue
  27.         ruScrap="$(ScraP)"; mgnet="$(dFiltR)"
  28.         echo "`myDMin` $viewt $mgnet  $ruRLS" | tee -a "$ruLog"
  29.         $trCMD -a "$mgnet" -w"$WDIR" -sr 2.00 1>/dev/null
  30.     done < <(sed -n 's/\[CDATA\[/\n/gp'<<<`ruFeed` | sed -r 's/ +/./g ; s/\.?[([].*href="(.*)"..>.*/ \1/ ; s/\&amp;/\&/g')
  31.  
  32.     sleep `shuf -i 550-700 -n 1`
  33.  
  34. done
Advertisement
Add Comment
Please, Sign In to add comment