Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python - Scrapy - Contains
#1
Lets say we have this html, and we wanted to say if the tr in td contains EAN:, Print me the 2nd td in the same element

response.xpath('//strong[contains( text(), "EAN:")]/text()').extract()
<tr class="product-model">
   <td><strong>EAN:</strong></td>
   <td> 4048961089302</td>
</tr>

<tr class="product-model">
   <td><strong>Product.Nr.:</strong></td>
   <td> 83003</td>
</tr>
thank you :D
Reply


Messages In This Thread
Python - Scrapy - Contains - by Baggelhsk95 - Oct-26-2018, 12:49 PM
RE: Python - Scrapy - Contains - by stranac - Oct-26-2018, 04:05 PM
RE: Python - Scrapy - Contains - by Baggelhsk95 - Oct-27-2018, 06:41 AM
RE: Python - Scrapy - Contains - by stranac - Oct-27-2018, 03:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Scrapy Date Extraction Issue tr8585 1 4,350 Aug-05-2020, 04:32 AM
Last Post: tr8585
  Python Scrapy tr8585 2 3,330 Aug-04-2020, 04:11 AM
Last Post: tr8585
  Python - Scrapy Baggelhsk95 0 2,753 Apr-24-2019, 01:07 PM
Last Post: Baggelhsk95
  Python Scrapy ebay API Baggelhsk95 0 3,802 Nov-21-2018, 11:22 AM
Last Post: Baggelhsk95
  Python scrapy scraped_items Baggelhsk95 2 3,650 Nov-13-2018, 08:30 AM
Last Post: Baggelhsk95
  Python - Scrapy - CSS selector Baggelhsk95 1 6,525 Nov-07-2018, 04:45 PM
Last Post: stranac
  Python - Scrapy Login in Baggelhsk95 3 5,826 Oct-23-2018, 04:24 PM
Last Post: stranac
  Python - Scrapy Ebay Test Baggelhsk95 4 5,359 Oct-16-2018, 12:37 PM
Last Post: snippsat
  Python - Scrapy Login form Baggelhsk95 4 12,365 Oct-16-2018, 08:01 AM
Last Post: Baggelhsk95
  Python - Scrapy Javascript Pagination (next_page) Baggelhsk95 3 11,441 Oct-08-2018, 01:20 PM
Last Post: stranac

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020