Estoy tratando de analizar revisión de esta página: http://www.amazon.co.uk/product-reviews/B00143ZBHYNo es capaz de analizar HTML usando lxml Xpath analizador
Utilizando el enfoque siguiente:
Código
html # a variable which contains exact html as given at the above page.
from lxml import etree
tree = etree.HTML(html)
r = tree.xpath(".//*[@id='productReviews']/tbody/tr/td[1]/div[9]/text()[4]")
print len(r)
print r[0].tag
salida
0
Traceback (most recent call last):
File "c.py", line 37, in <module>
print r[0].tag
IndexError: list index out of range
p, s ,: Mientras uso el mismo xpath en el complemento xpath checker de firefox, puedo hacerlo todo fácilmente. Pero no hay resultados aquí, ¡por favor ayuda!
no saben qué cromo mostró tbody en XPath :( – codersofthedark
Se genera automáticamente – fedosov