0

I am trying to use Beautiful Soup in Python to scrape some product information from a website (https://www.staples.ca/products/2764644-en-brother-dcp-l2550dw-all-in-one-monochrome-mobile-ready-laser-printer), specifically the Item Number (2764644)

I see this line in the HTML:

<span class="product-property__item">Item:  2764644</span>

But when I use this soup.find, but the result is "None/NoneType":

SKU = soup.find("span", {"class":"product-property__item"})
print (SKU)

However, I tried to debug by seeing if I could find anything up the tags, and this partially worked:

maintext = soup.find("main", {"id":"MainContent"})
print (maintext)

But doesn't show all the information I need, and I have to do further parsing. Any idea why I can't find/read the first tag?

  • Check that soup includes the correct (expected) HTML tag. – Gilseung Ahn Dec 14 '21 at 05:00
  • "I see this line in the HTML:" I don't. Try viewing page source with Javascript disabled. BeautifulSoup cannot handle dynamic content - or rather, whatever you used to actually *make the HTML request* cannot. – Karl Knechtel Dec 14 '21 at 05:00
  • @KarlKnechtel I see thanks. I was looking at the HTML via inspect instead of viewing the page source. Disabling Javascript also did not render the page. – stackunderflow Dec 14 '21 at 13:55

0 Answers0