Не парсит другие страницы сайта
проблема в том, что скрипт не парсит другие страницы. Т.е в параметрах url номер страницы меняется но содержимое страницы дублируется с первой страницы. т.е при парсинге к примеру 100 страниц, у меня просто появляется 100 дублей элементов первой страницы. Подскажите как решить эту проблему? Заранее благодарен
import requests
from bs4 import BeautifulSoup
headers = {
'Accept': '*/*',
'Bx-ajax': 'true',
'sec-ch-ua-platform': "macOS",
'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.32 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.32"
}
response = requests.get(f"https://bikeland.ru/catalog/f/discount_product-is-y/?PAGEN_2=1")
soup = BeautifulSoup(response.text, 'html.parser')
names = soup.findAll("span", class_="catalog-list-tile__name js-cut-text")
hrefs = soup.findAll("a", class_="catalog-list-tile")
count_pages = int(soup.findAll("a", class_="paging__item")[-1].text)
for page_count in range(1, 3):
url = f"https://bikeland.ru/catalog/f/discount_product-is-y/?PAGEN_2={page_count}"
response = requests.get(url=url, headers=headers)
print(url)
for href in hrefs:
if "catalog" in href["href"]:
print(f"{page_count}/{count_pages}")
print("https://bikeland.ru"+href["href"])