import requests
import urllib
from bs4 import BeautifulSoup
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36"
}
for idx in range(1, 17):
url = "https://www.coupang.com/np/categories/311357?page=" + str(idx)
print(url)
result = requests.get(url, headers=headers)
soup_obj = BeautifulSoup(result.content, "html.parser")
div = soup_obj.findAll("div", {"class": "name"})
lis = soup_obj.find("ul", {"id": "productList"}).findAll("li")
for li in lis:
name = li.find("div", {"class": "name"})
img = li.find("dt", {"class": "image"}).find("img", {"src": ""})
print("name: " + name.text.strip())
urllib.request.urlretrieve(img, "./imagepile")
// urllib.request.urlretrieve (img, "./imagepile") как исправить эту строку кода? пл