python 3.x - Problems with xpath on scrapy -
i'm using scrapy create crawler.
i want extract title of links found.
this current part of code it's important me:
<a class="cor-produto busca-titulo" title="melhorar saúde, economia de tempo e dinheiro: veja os benefícios uso da bicicleta" href="//g1.globo.com/busca/click?q=economia&p=0&r=1472008380299&u=http%3a%2f%2fg1.globo.com%2fma%2fmaranhao%2fjmtv-2edicao%2fvideos%2fv%2fmelhorar-a-saude-economia-de-tempo-e-dinheiro-veja-os-beneficios-do-uso-da-bicicleta%2f5256064%2f&t=informacional&d=false&f=false&ss=8bcd843f636c6982&o=&cat=a">melhorar saúde, economia de tempo e dinheiro: veja os benefíc...</a>
i want extract title , need use xpath this. have suggestion?
thank you! :)
the xpath be:
//a/@title
being sel selector instance:
sel.xpath('//a/@title').extract()
or maybe response object:
response.xpath('//a/@title').extract()
output:
melhorar saúde, economia de tempo e dinheiro: veja os benefícios uso da bicicleta
Comments
Post a Comment