News Feed Forums General Web Scraping Scrape product specifications, images, shipping details -Amazon Brazil -Python

  • Scrape product specifications, images, shipping details -Amazon Brazil -Python

    Posted by Astghik Kendra on 12/12/2024 at 10:49 am

    To scrape product specifications from Amazon Brazil, use Selenium to locate the product details section, often formatted as a table or list. Extract the specifications using find_elements and iterate through the rows or items to collect the data.

    from selenium import webdriver
    from selenium.webdriver.common.by import By
    driver = webdriver.Chrome()
    driver.get('https://www.amazon.com.br/dp/product-page')
    # Scrape specifications
    specs = driver.find_elements(By.CSS_SELECTOR, '.product-specs tr')
    for spec in specs:
        key = spec.find_element(By.CSS_SELECTOR, 'th').text
        value = spec.find_element(By.CSS_SELECTOR, 'td').text
        print(f"{key}: {value}")
    driver.quit()
    
    Jay Zorka replied 1 week, 2 days ago 3 Members · 2 Replies
  • 2 Replies
  • Shyamala Laura

    Member
    12/13/2024 at 8:06 am

    To scrape product images, identify the img tags containing image URLs, usually part of a gallery. Use Selenium to extract the src attribute for all available images on the page.

    from selenium import webdriver
    from selenium.webdriver.common.by import By
    driver = webdriver.Chrome()
    driver.get('https://www.amazon.com.br/dp/product-page')
    # Scrape product images
    images = driver.find_elements(By.CSS_SELECTOR, '.product-image-gallery img')
    for img in images:
        print('Image URL:', img.get_attribute('src'))
    driver.quit()
    
  • Jay Zorka

    Member
    12/13/2024 at 9:45 am

    To extract shipping details, locate the section that shows delivery options, such as estimated delivery dates or shipping costs. Using Selenium, find and extract the text from the relevant div or span elements.

    from selenium import webdriver
    from selenium.webdriver.common.by import By
    driver = webdriver.Chrome()
    driver.get('https://www.amazon.com.br/dp/product-page')
    # Scrape shipping details
    shipping = driver.find_element(By.CSS_SELECTOR, '.shipping-info').text
    print('Shipping Details:', shipping)
    driver.quit()
    

Log in to reply.