I want to scrap every image and title from a web and download it into a .jpg. I don't know why the program isn't entering the for cycle
from PIL import Image
import io
import win32api
import requests
from bs4 import BeautifulSoup as b
url = 'https://www.redbubble.com/es/shop/mens-t-shirts'
path_photos = r'C:\Users\Usuario\OneDrive\Escritorio\JUAN_PROGRAMACION\FOTOS_RODRI'
headers = {
"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 OPR/90.0.4480.84",
"accept-encoding":"gzip, deflate, br",
"accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
}
html = requests.get(url,headers=headers)
content = html.content
soup = b(content,"lxml")
i = 1
for post in soup.findAll('div',{"class":"styles__card--gABg1 styles__rounded--3cLNg styles__transparent--1-Y5b styles__elevationLow--178j0"}):
title = post.find('span',{"class":"styles__box--2Ufmy styles__text--23E5U styles__display6--3wsBG styles__nowrap--33UtL styles__display-block--3kWC4"}).text
url_img = post.find('img')['src']
r = requests.get(url_img)
file = io.BytesIO(r.content)
img = Image.open(file)
img.save(path_photos+"\\"+str(title)+".jpg")
print(i)
i += 1
win32api.MessageBox(False,'Proceso terminado','Finalizado',0x00001000)