samedi 5 juillet 2014

Scrampling some web page by using XPath


Vote count:

0




I'm scrampling some web pages in order to get some informations. I'm using Scrampy and XPath language.


This is an example of page I would get



<div class="hgroup">
<a href="link1">
<h5>brand</h5>
<h3>version</h3>
</a>
</div>

...

<div class="hgroup">
<a href="link2">
<h5>brand</h5>
<h3>version</h3>
</a>
</div>


I'm using this syntax to get all the div which have hgroup class unfortunately when I try to print print out models variable this is empty



def parse(self, response):

sel = Selector(response)
models = sel.xpath("//div[@class='hgroup']/a")


asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire