Python Forum

Full Version: BeautifulSoup Showing none while extracting image url
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello Everyone!
I am trying to extract images url from gallery images on woocommerce website, but its showing none when I tried through csv file. Also I want extract variation color. Here is my code
import csv

from bs4 import BeautifulSoup
import requests
from urllib.request import urlretrieve
import os
import urllib
import pandas as pd

data_dic = {}
with open('D:/Scrapping/Newfolder/Urls.csv') as csvFile:
    data = csv.DictReader(csvFile)
    for row in data:
        request = requests.get(row['url'])
        soup = BeautifulSoup(request.content, 'html.parser')
        print(soup.prettify)
for images in soup.find_all('div', {'class': 'woocommerce-product-gallery__image'}):
    print(images.find('a')['href'])
here is output

Output:
PS D:\Scrapping> d:; cd 'd:\Scrapping'; & 'C:\Users\Asim\AppData\Local\Programs\Python\Python39\python.exe' 'c:\Users\Asim\.vscode\extensions\ms-python.python-2021.9.1230869389\pythonFiles\lib\python\debugpy\launcher' '59785' '--' 'd:\Scrapping\ztest.py' PS D:\Scrapping>