'How can I filter a loop and "save for later" the result?
I'm trying to scrape the amazon website for a project I'm working on.
Until now I've built this flow
driver = webdriver.Chrome(executable_path=r"C:\Users\chromedriver.exe")
driver.maximize_window()
wait=WebDriverWait(driver,20)
driver.get('hhttps://www.amazon.it/s?k=shoes&__mk_it_IT=%C3%85M%C3%85%C5%BD%C3%95%C3%91&crid=3B00FY4A5NJBZ&sprefix=shoes'
'%2Caps%2C122&ref=nb_sb_noss')
products = driver.find_elements(By.CSS_SELECTOR, 'div[class = "sg-col-4-of-12 s-result-item s-asin sg-col-4-of-16 sg-col '
's-widget-spacing-small sg-col-4-of-20"]')
for product in products:
name = product.find_element(By.CSS_SELECTOR, 'span[class = "a-size-base-plus a-color-base a-text-normal"]').text
brand = product.find_element(By.CSS_SELECTOR, 'span[class = "a-size-base-plus a-color-base"]').text
price = product.find_element(By.CSS_SELECTOR, 'span[class = "a-price-whole"]').text
After generating this flow I want to filter the results by price (for example I want to maintain everything below 100€) and "save" the outputon a list/group to concatenate it with another loop results
Thanks Car
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
