Página 1 de 1

Parser HTML

Publicado: 17 Abr 2011, 22:43
por blablableble
Buenas,

Hace tiempo comenté sobre portar algún tipo de parser html para facilitar el desarrollar los canales, no es que lo haya hecho yo, pero usando los bindings de python de selenium v2 ( http://seleniumhq.org/download/ ) ( es una aplicación de testear webs para los procesos de desarrollo ) he hecho un script que parsea todo series yonkis entera y te saca los links que hay. En la versión de xbox no se si seria posible usarlo, ya que usa algunas modulos propios y no se si funcionarian en xbox.

EL script son poco más de 50 lineas y decodifica incluso los links.

Selenium funciona lanzando una ventana del navegador y mandándole órdenes y preguntando al navegador los datos con lo que no hay necesidad de decodificar los links, etc con lo que mientras esta en ejecución vamos viendo todos los pasos que hace en la ventana abierta, hay un modulo que trabaja sin ventana pero no lo he probado.

Las instrucciones de instalar selenium con los bindings de python son: http://pypi.python.org/pypi/selenium, el driver de chrome y firefox (estan en:

http://code.google.com/p/selenium/wiki/ChromeDriver

http://code.google.com/p/selenium/wiki/FirefoxDriver

respectivamente (hay que cambiar la linea 15 por la 14 para usar firefox, aunque solo lo he probado entero con chrome) y el script de seriesyonkis lo podeis encontrar en http://rafb.ath.cx/pastes/5cp1oY82.html .

El ejemplo de ejecución es:

~/selenium$ python seriesyonkis.py
UTF-8
http://www.seriesyonkis.com/lista-series.php#aseries Series:
http://www.peliculasyonkis.com/lista-peliculas.php películas aquí
http://www.seriesyonkis.com/serie/allo-allo/ 'Allo 'Allo!
http://www.seriesyonkis.com/serie/099-central/ 099 Central
http://www.seriesyonkis.com/serie/10-ra ... a-odiarte/ 10 razones para odiarte
http://www.seriesyonkis.com/serie/100-anos-del-comic/ 100 años del cómic
(tarda bastante en leer el link completo de las series)
(...)
http://www.seriesyonkis.com/serie/zack- ... s-a-bordo/ Zack y Cody Todos a Bordo
http://www.seriesyonkis.com/serie/zeke-y-luther/ Zeke y Luther
http://www.seriesyonkis.com/serie/zen/ ZEN
http://www.seriesyonkis.com/serie/zoey-101/ Zoey 101
(un array con todas las series muy grande)
(un array con los capitulos de la serie que esta procesando)
(y luego ya los links: titulo, idioma, subtitulos, informacion varia, link)
'Allo 'Allo! 1x01 - Llegan los ingleses (Parte I) [u'Espa\xf1ol (Spanish)', u'no', u'Duraci\xf3n: 34.8', 'http://www.megavideo.com/?s=seriesyonki ... onfirmed=1']
'Allo 'Allo! 1x01 - Llegan los ingleses (Parte I) [u'Espa\xf1ol (Spanish)', u'no', u'Duraci\xf3n: 34.8', 'http://www.megavideo.com/?s=seriesyonki ... onfirmed=1']
'Allo 'Allo! 1x01 - Llegan los ingleses (Parte I) [u'Espa\xf1ol (Spanish)', u'no', u'Duraci\xf3n: 34.8', 'http://www.megavideo.com/?s=seriesyonki ... onfirmed=1']
'Allo 'Allo! 1x01 - Llegan los ingleses (Parte I) [u'Espa\xf1ol (Spanish)', u'no', u'349.01 MB\nFormato: avi (XviD / mp3)\nResoluci\xf3n: 576x432\nDuraci\xf3n: 34.8', 'http://www.megaupload.com/?s=seriesyonk ... onfirmed=1']
'Allo 'Allo! 1x01 - Llegan los ingleses (Parte I) [u'Espa\xf1ol (Spanish)', u'no', u'349.01 MB\nFormato: avi (XviD / mp3)\nResoluci\xf3n: 576x432\nDuraci\xf3n: 34.8', 'http://www.megaupload.com/?s=seriesyonk ... onfirmed=1']
'Allo 'Allo! 1x01 - Llegan los ingleses (Parte I) [u'Espa\xf1ol (Spanish)', u'no', u'349.01 MB\nFormato: avi (XviD / mp3)\nResoluci\xf3n: 576x432\nDuraci\xf3n: 34.8', 'http://www.megaupload.com/?s=seriesyonk ... onfirmed=1']
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'Allo 'Allo! 1x02 - Llegan los ingleses (Parte II) [u'Espa\xf1ol (Spanish)', u'no', u'Duraci\xf3n: 28.9', 'http://www.megavideo.com/?s=seriesyonki ... onfirmed=1']
'Allo 'Allo! 1x02 - Llegan los ingleses (Parte II) [u'Espa\xf1ol (Spanish)', u'no', u'Duraci\xf3n: 28.9', 'http://www.megavideo.com/?s=seriesyonki ... onfirmed=1']
'Allo 'Allo! 1x02 - Llegan los ingleses (Parte II) [u'Espa\xf1ol (Spanish)', u'no', u'Duraci\xf3n: 28.9', 'http://www.megavideo.com/?s=seriesyonki ... onfirmed=1']
'Allo 'Allo! 1x02 - Llegan los ingleses (Parte II) [u'Espa\xf1ol (Spanish)', u'no', u'349.01 MB\nFormato: avi (XviD / mp3)\nResoluci\xf3n: 576x432\nDuraci\xf3n: 34.8', 'http://www.megaupload.com/?s=seriesyonk ... onfirmed=1']
'Allo 'Allo! 1x02 - Llegan los ingleses (Parte II) [u'Espa\xf1ol (Spanish)', u'no', u'348.36 MB\nFormato: avi (XviD / mp3)\nResoluci\xf3n: 576x432\nDuraci\xf3n: 28.9', 'http://www.megaupload.com/?s=seriesyonk ... onfirmed=1']
'Allo 'Allo! 1x02 - Llegan los ingleses (Parte II) [u'Espa\xf1ol (Spanish)', u'no', u'348.36 MB\nFormato: avi (XviD / mp3)\nResoluci\xf3n: 576x432\nDuraci\xf3n: 28.9', 'http://www.megaupload.com/?s=seriesyonk ... onfirmed=1']
'Allo 'Allo! 1x02 - Llegan los ingleses (Parte II) [u'Espa\xf1ol (Spanish)', u'no', u'348.17 MB\nFormato: avi (XviD / mp3)\nResoluci\xf3n: 576x432\nDuraci\xf3n: 31.7', 'http://www.megaupload.com/?s=seriesyonk ... onfirmed=1']
'Allo 'Allo! 1x02 - Llegan los ingleses (Parte II) [u'Espa\xf1ol (Spanish)', u'no', u'348.36 MB\nFormato: avi (XviD / mp3)\nResoluci\xf3n: 576x432\nDuraci\xf3n: 28.9', 'http://www.megaupload.com/?s=seriesyonk ... onfirmed=1']
....


Saludos

Re: Parser HTML

Publicado: 22 Abr 2011, 00:13
por jesus
Tiene el inconveniente de que no funciona en el ATV, por ejemplo.

Pero todo lo demás son ventajas :)

Gracias por la información.