Код:
url = 'https://bt.rozetka.com.ua/keramika/c117101/'
response = requests.get(url=url, headers=headers)
soup = BeautifulSoup(response.text, "lxml")
pages_count = int(soup.find("div", class_="pagination ng-star-inserted").find_all("li")[-1].text)
offset = 0
result_list = []
for page in range(1, pages_count + 1):
url = url+f"page={page}/"
response = requests.get(url=url, headers=headers)
soup = BeautifulSoup(response.text, "lxml")
items = soup.find("div", class_="catalog").find_all("li")
index = 0
for item in items:
item_id = int(soup.find("div", class_="g-id display-none").text)
print(item_id)
cost = f"https://rozetka.com.ua/api/product-api/v4/goods/get-main?front-type=xl&country=UA&lang=ru&goodsId={item_id}"
infos = requests.get(url=cost, headers=headers)
info = infos.json()
item = info["data"]
result_list.append({
"title" : item.get("title"),
"price" : item.get("price"),
"old_price" : item.get("old_price"),
"price_usd" : item.get("price_pcs"),
"status" : item.get("sell_status"),
})
index +=1
print(result_list)
offset+=1
print(offset)
Заранее спасибо за помощь