Diferencia entre revisiones de «LSWC scraping the web/taller scraping lwsc 2011»

De WikiEducator
Saltar a: navegación, buscar
Línea 26: Línea 26:
  
 
doc = html.parse(URL)
 
doc = html.parse(URL)
 +
</source>
 +
[{Tip|'''doc''' tiene toda la información del documento}}
 +
}}
 +
 +
{{Ejemplo|
 +
TOCdepth=3
 +
Title=Ejemplo base|
 +
Listado de cursos del INAEM: http://plan.aragon.es/MapaRec.nsf/fmrListado?OpenForm
 +
}}
  
 
}}
 
}}

Revisión de 03:18 7 nov 2011


Actividad

Icon objectives.jpg

Objetivo

  • Introducción a las técnicas básicas de scraping usando Python y Amara
  • Herramientas de ayuda (firebug, curl, ...)


Configuración del entorno

Icon activity.jpg

Configuración del entorno

  • Instalación de amara
$ sudo pip install http://files.akara.info/00-amara-latest.tar.bz2
Icon present.gif
Tip: Es necesario tener instalado un compilador de C y la cabeceras de python (en debian/ubuntu hay que instalar python-dev)


  • Instalar firebug
https://addons.mozilla.org/es-es/firefox/addon/firebug/






Lectura básica de un documento

Icon activity.jpg

Lectura básica de un documento

  1. from amara.bindery import html
  2. URL = 'http://mypage.com'
  3.  
  4. doc = html.parse(URL)

[{Tip



}}



Icon casestudy.gif

Ejemplo

Listado de cursos del INAEM: http://plan.aragon.es/MapaRec.nsf/fmrListado?OpenForm




}}