From ae7fb1b9b2334a733d5b2981e7636caf255bc884 Mon Sep 17 00:00:00 2001 From: AlberLC Date: Mon, 3 Apr 2023 11:22:07 +0200 Subject: [PATCH] Update UberEatsBot._scrape_codes --- flanabot/bots/ubereats_bot.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/flanabot/bots/ubereats_bot.py b/flanabot/bots/ubereats_bot.py index fda93f3..b892a1b 100644 --- a/flanabot/bots/ubereats_bot.py +++ b/flanabot/bots/ubereats_bot.py @@ -61,12 +61,25 @@ class UberEatsBot(MultiBot, ABC): self.task_contexts[chat.id]['browser'] = browser context: playwright.async_api.BrowserContext = await browser.new_context( storage_state={'cookies': cookies}, - user_agent=flanautils.USER_AGENT + user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.5615.49 Safari/537.36', + screen={ + 'width': 1920, + 'height': 1080 + }, + viewport={ + 'width': 1280, + 'height': 720 + }, + device_scale_factor=1, + is_mobile=False, + has_touch=False, + default_browser_type='chromium', + locale='es-ES' ) context.set_default_timeout(3000) page = await context.new_page() - await page.goto('https://www.myunidays.com/ES/es-ES/partners/ubereats/access/online') + await page.goto('https://www.myunidays.com/ES/es-ES/partners/ubereats/access/online', timeout=30000) if button := await page.query_selector("button[class='button highlight']"): await button.click()