Last active
March 7, 2020 09:49
-
-
Save andy23512/4cf2bf06e2e68879a5983827317258c3 to your computer and use it in GitHub Desktop.
ATTENTION! This program do not actually download youtube video asynchronously!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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