samedi 29 août 2020

(Python) Trying to parse with beautifulsoup on a webpage that updates after its initial load

For example, if you go here: https://www.basspro.com/shop/en/herters-hunting-rifle-ammo/

you'll notice on the first load, it'll show everything in stock. Then, the page will update again and show all the things which are out of stock.

Is there any way to use beautifulsoup to account for this? I'm starting to think I'm going to need to use a different strategy to pull the updated HTML code.

Because as it stands, my code

`content_wrapper = soup.find('div', class_='col2 gridCell StoreAvail editable anchored', id='StoreAvail_7') cheese = content_wrapper.find('div', class_='sublist instore_inventory_section nodisplay', id='WC_InStore_Inventory_Section_3074457345618960372')

print(cheese)`

returns nothing because there is no "out of stock" text in the code that beautifulsoup pulls.

Thanks for reading.




Aucun commentaire:

Enregistrer un commentaire