Extracting Text/Parameter *within* a Tag



I have the following source code from which I am attempting to extract my desired information:



<div id="PaginationBottom" class="pagination">
<a href="#" data-page="2" title="page 2 of 31" >2</a>
<a href="#" data-page="3" title="page 3 of 31" >3</a>
<a href="#" data-page="4" title="page 4 of 31" >4</a>
<a href="#" data-page="10" title="page 10 of 31" >10</a>
<a href="#" data-page="2" title="page 2 of 31" class="next" >next &raquo;</a>


What I want to extract is the title="page 2 of 31" information from within the final tag itself. I can get the tag with the following code:



response.xpath('//div[@id="PaginationBottom"]//a[@class="next"]').extract()


Thus, what I'd like to know is whether it is possible to extract a parameter's text from within the tag itself. Is it? I can't find information on this anywhere, but I'm brand new to xpath and don't know the best search terms. Thanks for any help!


No comments:

Post a Comment