Tema: Problema
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/11/2010, 13:39
Avatar de razpeitia
razpeitia
Moderador
 
Fecha de Ingreso: marzo-2005
Ubicación: Monterrey, México
Mensajes: 7.321
Antigüedad: 19 años, 1 mes
Puntos: 1360
Respuesta: Problema

No uses expresiones regulares para parsear html o xml en vez de eso usa un parser.
Como lxml o BeautifulSoup

Al parecer no es tan fácil de hacer un spider. Lo probe con python 2.6 y me marco esto.
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  3.     <title>Vimeo / 403 Forbidden</title>
  4.        
  5.     <style type="text/css">
  6.         body {
  7.             background:red;
  8.             font-family:arial,san-serif;
  9.             font-size:18px;
  10.             font-weight:normal;
  11.             color:white;
  12.             margin:75px;
  13.         }
  14.     </style>
  15. </head>
  16.     <p><h1>You are blocked from Vimeo</h1></p>
  17.     <p>The connection you are using has been blocked from communicating with Vimeo's servers. This ban will never be lifted.</p>
  18.     <div style="display:none">1288726562</div>
  19.     <p>If you are human and think this is an error, please <a href="mailto:[email protected]?body=I have been banned. My IP is x.x.x.x and my browser is Python-urllib/1.17">click here</a>.</p>
  20.     <br />
  21.     <p><em>"It's too bad she won't live. But then again, who does?"</em></p>
  22. </body>
  23. </html>

Al parecer también tienes que añadir algunos headers al request que estas haciendo.