Skip to content

Commit

Permalink
[apps/browser] minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
javierluraschi committed Sep 12, 2024
1 parent b9be684 commit 5ea8c33
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions apps/browser/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def wrap_in_async_function(code):
return wrapped_code

async def main():
print(f"Starting new browser session...")

custom_user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"
browser = await pyppeteer.launch(
headless=True,
Expand All @@ -34,7 +36,6 @@ async def main():
prompt = h9.input()
site = site_find(prompt)

print(f"Starting new browser session. Navigating to {site}")
await page.goto(site)

while True:
Expand All @@ -50,7 +51,6 @@ async def main():

await local_vars['dynamic_async_func'](page)

prompt = h9.input(f"Taking screenshot, what next?")
await take_screenshot(page, i)
except Exception as e:
print(f"Failed to use browser:\n```\n{e}\n```\n")
Expand All @@ -62,7 +62,4 @@ async def main():

await browser.close()

print("Five tasks completed, this browser session is restarting.")
print("🌐 I can browse the web, how can I help?")

asyncio.get_event_loop().run_until_complete(main())

0 comments on commit 5ea8c33

Please sign in to comment.