Skip to content

Instantly share code, notes, and snippets.

@andy23512
Last active March 7, 2020 09:49
Show Gist options
  • Save andy23512/4cf2bf06e2e68879a5983827317258c3 to your computer and use it in GitHub Desktop.
Save andy23512/4cf2bf06e2e68879a5983827317258c3 to your computer and use it in GitHub Desktop.
ATTENTION! This program do not actually download youtube video asynchronously!
import asyncio
import youtube_dl
async def progress(url):
print('Progressing: ', url)
await asyncio.sleep(1)
with youtube_dl.YoutubeDL({}) as ydl:
ydl.download([url])
print('End: ', url)
async def main():
urls = [
"https://www.youtube.com/watch?v=uiTbyKrKsYM",
"https://www.youtube.com/watch?v=RKtoreimcQ8"
]
await asyncio.gather(
*[progress(url) for url in urls]
)
asyncio.run(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment