Add SteamBot

This commit is contained in:
AlberLC
2024-07-04 03:56:22 +02:00
parent 848d354da2
commit 4e44cdd112

View File

@@ -119,8 +119,9 @@ class SteamBot(MultiBot, ABC):
except playwright.async_api.TimeoutError:
raise LimitError('🚫 Steam ban: espera 5 minutos antes de consultar de nuevo.')
for td in await page.query_selector_all('tr td a[href]'):
href = await td.get_attribute('href')
locator = page.locator('tr td a[href]')
for i in range(await locator.count()):
href = await locator.nth(i).get_attribute('href')
app_ids.add(re.search(re_pattern, href).group(1))
return app_ids
@@ -168,7 +169,9 @@ class SteamBot(MultiBot, ABC):
async with self._create_browser_context(browser) as context:
page = await context.new_page()
await page.goto(f'{constants.STEAM_DB_URL}/app/{app_id}/')
for td in await page.query_selector_all("#prices td[class='price-line']"):
locator = page.locator("#prices td[class='price-line']")
for i in range(await locator.count()):
td = locator.nth(i)
src = (await td.locator('img').get_attribute('src'))
name = (await td.text_content()).strip()
flag_url = f'{constants.STEAM_DB_URL}{src}'