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&amp;p=0&amp;r=1472008380299&amp;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&amp;t=informacional&amp;d=false&amp;f=false&amp;ss=8bcd843f636c6982&amp;o=&amp;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

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -