0

Here is a sample link i am scraping: https://www.homedepot.com/p/ZLINE-Kitchen-and-Bath-ZLINE-30-in-Wooden-Wall-Mount-Range-Hood-in-Walnut-Includes-Remote-Motor-KBRR-RS-30/311456581?MERCH=REC-_-rv_gm_pip_rr-_-303727628-_-311456581-_-N

enter image description here

I'm trying to get the internet number and I have tried both css and xpaths

Here's what I've tried

productOMS = product.xpath("//span[@id='product_ID']").getall()

or

productOMS = product.css(".product_internet_number::text").getall()

and here is the html snippet I'm trying to scrape:

<span itemprop="productID" id="product_internet_number" class="" style="" xpath="1">311456581</span>

I also used a xpath selector extension on chrome which gave me

enter image description here

when I use CSS I have a blank field returned and when I use xpath I get something like:

"< span itemprop="productID" id="product_internet_number">312028174"

Any help would be appreciated!

1 Answer 1

1

try

response.xpath("//span[@id='product_internet_number']/text()").extract()

if you are following up in a sub-selector named product from response object then:

product.xpath(".//span[@id='product_internet_number']/text()").extract()
Sign up to request clarification or add additional context in comments.

1 Comment

that solved it! ill mark as an answer when it lets me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.