Answer the question
In order to leave comments, you need to log in
How to run it at the same time?
There is a code
import asyncio
from pyppeteer import launch
async def main():
browser = await launch()
page = await browser.newPage()
for i in range(100):
await page.goto('https://www.avito.ru/belgorod/nastolnye_kompyutery/sistemnyy_blok_1885815175')
print('+1')
# await page.screenshot({'path': 'example.png'})
await browser.close()
asyncio.get_event_loop().run_until_complete(main())
Answer the question
In order to leave comments, you need to log in
I can suggest this
import asyncio
from pyppeteer import launch
async def text():
browser = await launch()
page = await browser.newPage()
await page.goto('https://www.avito.ru/belgorod/nastolnye_kompyutery/sistemnyy_blok_1885815175')
print('+1')
# await page.scre
async def main():
tasks = [] # здесь будут все задачи
for x in range(100): # запускаем 100 раз
task = asyncio.create_task(text()) # создаем новый таск
tasks.append(task) # и добавляем в наш общий список
await asyncio.gather(*tasks) # распаковываем и запускаем
asyncio.run(main())
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question