Ошибка превышения количества запросов при парсинге Авито
Делал парсер, но получал ошибку превышения запросов несмотря на то, что я использовал сменные юзер-агенты, платные прокси, очистку куков и смену сессий. Так же выставил микрозадержку между запросами. Решил проверить, может это в сайте проблема. Поэтому попробовал спарсить страницу на Авито. Вот код:
import requests
from bs4 import BeautifulSoup
from random import choice, uniform
from requests.auth import HTTPProxyAuth
from time import sleep
for i in range(1, 74):
session = requests.session()
proxy_auth = HTTPProxyAuth("login","password")
with open("user-agent.txt") as user_agent_file:
user_agent = eval(user_agent_file.read())
get_headers = {'user-agent': choice(user_agent)}
with open("proxy_list.txt") as https_proxy_list_file:
https_proxy_list = eval(https_proxy_list_file.read())
proxy = {'http': f'http://{choice(https_proxy_list)}'}
print(f'Страница {i}...')
sleep(uniform(1,2))
session.cookies.clear()
html = session.get(f'https://www.avito.ru/rossiya/avtomobili/mitsubishi/lancer?cd=1&p={i}', headers = get_headers, proxies = proxy, auth = proxy_auth).text
soup = BeautifulSoup(html, 'html.parser')
main_block = soup.find('div', class_ = 'items-items-38oUm')
main_block_childern = main_block.findChildren()
for child in main_block_childern:
try:
title = child.find('h3', class_ = 'title-root-395AQ').get_text(strip = True)
price = child.find('span', class_ = 'price-text-1HrJ_').get_text(strip = True)
city = child.find('span', class_ = 'geo-address-9QndR').find_next('span').get_text(strip = True)
print(f'{title} - {price} ({city})')
except Exception as e:
# print(e)
pass
Но как результат запроса, получаю страницу на которой указано что я превысил количество запросов. Как такое может быть, что сайт опознаёт парсер?