Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # programado por Juanmol para http://rsppi.blogspot.com
  3. minimo=70
  4. wget http://thepiratebay.se/search/es%7Ccastellano%7Cesp%7Cspanish/0/7/207 -O /tmp/salida_pelis2
  5.  
  6. echo $(cat /tmp/salida_pelis2 | grep -e "/torrent/" -e "magnet:" | sed 's/\ /\n/g' | grep href | grep -v "/user/" | cut -f2 -d\") | sed 's/\ /@/g' | sed 's/\//@/g' | sed 's/@@/\n/g' | sed 's/torrent@//g' | grep -i -v -f lista_negra.txt > /tmp/filtro.txt
  7.  
  8. cat /tmp/filtro.txt | sed 's/^@//g' > /tmp/filtro_tmp.txt
  9. mv /tmp/filtro_tmp.txt /tmp/filtro.txt
  10.  
  11. for n in $(seq 1 $(cat /tmp/filtro.txt | wc -l ));
  12. do
  13.         codigo=$(cat /tmp/filtro.txt | head -$n | tail -1 | cut -f1 -d@);
  14.         peli=$(cat /tmp/filtro.txt | head -$n | tail -1 | cut -f2 -d@ | cut -f2 -d@ | cut -f1 -d\[ | cut -f1 -d\- | cut -f1 -d\( | sed 's/_/\ /g' | sed -e 's/ENG//g' -e 's/ESP//g' -e 's/Sub//g' -e 's/720p//g' -e 's/1800p//g' -e 's/BluRay//g' -e 's/DTS//g');
  15.         magnet=$(cat /tmp/filtro.txt | head -$n | tail -1 | cut -f3 -d@);
  16.         echo la peli: $peli;
  17.         echo el codigo: $codigo;
  18.         echo el magnet: $magnet;
  19.         if [ $(cat /root/pelisdescargadas/listado.txt | grep $codigo | wc -l) = 0 ];
  20.         then
  21.                 echo se descargaria;
  22.                 echo $codigo >> /root/pelisdescargadas/listado.txt;
  23.                 wget "http://www.imdb.com/find?q=$n&s=all" -O /tmp/busqueda_pelis 2> /dev/null;
  24.                 if [ $(cat /tmp/busqueda_pelis | grep "<title>Find - IMDb</title>" | wc -l) = 0 ];
  25.                 then
  26.                         echo se ha encontrado del tiron > /dev/null ;
  27.                 else
  28.                         echo no se ha encontrado, hay que filtrar > /dev/null ;
  29.                         filtrado=$(cat /tmp/busqueda_pelis | grep "findResult odd" | sed 's/\ /\n/g' | grep href | head -1 | cut -f3 -d\/);
  30.                         wget "http://www.imdb.com/title/$filtrado/" -O /tmp/busqueda_pelis 2> /dev/null ;
  31.                 fi
  32.                 rating=$(cat /tmp/busqueda_pelis | grep ratingValue | cut -f3 -d\< | cut -f2 -d\> | sed 's/\.//g');
  33.                 genero=$(echo $(cat /tmp/busqueda_pelis | grep genre | cut -f2 -d\> | cut -f1 -d\< | grep ^[A-Z]));
  34.                 echo la peli $peli tiene un rating de $rating y genero $genero;
  35.                 if [ "$(echo $rating)"  -gt "$minimo" ];
  36.                 then
  37.                         echo la puntuacion permite descargarla;
  38.                         if [ $(echo $genero | grep -i -v -f generos_no_permitidos.txt | wc -l ) = 0 ];
  39.                         then
  40.                                 echo uno de los generos esta baneado;
  41.                         else
  42.                                 echo A DESCARGAR!;
  43.                                 transmission-remote -a "$magnet";
  44.                                 /usr/local/bin/encola_whatsapp.sh 666777888"descargando automaticamente $peli";
  45.                         fi
  46.                 else
  47.                         echo la puntuacion es menor de $minimo;
  48.                 fi
  49.         else
  50.                 echo ya existe, no se descarga;
  51.         fi
  52. done
  53. rm /tmp/busqueda_pelis /tmp/filtro.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement