Can't scrape image with Python

Viewed 40

For some reason I am having a real hard time scraping the following code in python. ANy help would be appreciated.

Here is my code...

import requests
import pandas as pd
import urllib.parse
from bs4 import BeautifulSoup
import csv

baseurl = ('https://www.bornshoes.com/')

productlinks = []

for x in range(1,):
    r = requests.get('https://www.bornshoes.com/en/shop-womens-sandals/')
    soup = BeautifulSoup(r.content, 'html.parser')
    tag = soup.find_all('ul',{'class':'row product-grid mt-md-5'})
    
    for items in tag:
        for link in items.find_all('a', href=True):
            productlinks.append(baseurl + link['href'])
#print(productlinks)

for items in productlinks:
    r = requests.get(items)
    soup = BeautifulSoup(r.content, 'html.parser')
    
    imgurl = soup.find_all('img', class_='tile-image profileimg show')
    print(imgurl['src'])

And here is the piece of html I am trying scrape from...

<img class="tile-image profileimg show" src="https://bhsh.widen.net/content/kitaoixpgr/jpeg/br0035490-002.jpg?w=400&amp;h=400&amp;quality=80&amp;keep=s&amp;crop=no" alt="Sirena shown in White (Multicolor)" aria-hidden="false">
0 Answers
Related