import re
import requests
from bs4 import BeautifulSoup
from random import choice
http = ['http://89.23.112.143:80', 'http://84.47.161.3:8118', 'http://77.232.21.4:8080', 'http://194.67.91.153:80', 'http://195.161.41.163:8080']
current_proxy = {
'http': f'{choice(http)}',
}
def get_autobuy(steam_listing):
steam_url='https://steamcommunity.com/market/listings/730/'+steam_listing
current_proxy['http'] = choice(http)
html = requests.get(steam_url, proxies=current_proxy).text
soup = BeautifulSoup(html, 'lxml')
id = None
for script in soup.find_all('script'):
id_regex = re.search(r'Market_LoadOrderSpread(([ 0-9]+))', script.text)
if id_regex:
id = id_regex.groups()[0].strip()
break
if id:
current_proxy['http'] = choice(http)
id_url = f"https://steamcommunity.com/market/itemordershistogram?country=RU&language=english¤cy=5&item_nameid={id}&two_factor=0"
html = requests.get(id_url, proxies=current_proxy,headers='').json()
soup = BeautifulSoup(html['buy_order_summary'], 'lxml')
return float((soup.select_one('span:last-child').text).replace(' pуб.','').replace(',','.'))
else:
return 0
exit()
After 25 successful requests (there’s 2 requests in one iteration actually so ig the limit is 50) geting 429 response code even though i rotate proxys before every request.
If i turn on VPN then I can make 25 more, so I’m guessing maybe I coded the proxies part wrong, but can’t find answers anywhere or steam can see my real ip even through proxy. If i make a 10 seconds timeout I don’t get 429, even without proxies, but that’s too slow.
Tried different security level proxys but still nothing
Changing the protocols does nothing too, no matter whether it’s socks, ftp or other.
N0PEZ is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.