-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix throttling by using youtube-dl downloader #203
Conversation
pafy/backend_shared.py
Outdated
@@ -4,6 +4,7 @@ | |||
import time | |||
import logging | |||
import subprocess | |||
import random |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to import random
, or do we need to use it somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was planing to port the fix over. This is an artifiact of that!
I wonder if we should create a new function that returns Anyway, thanks a lot for this! I really hope this gets merged in. |
Thanks for the review! I guess it looks better now! |
pafy/backend_shared.py
Outdated
@@ -24,6 +24,12 @@ | |||
from .playlist import get_playlist2 | |||
from .util import xenc | |||
|
|||
try: | |||
import youtube_dl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be best to implement this change only for the youtube-dl backend?
Part of the issue with youtube-dl is start-up time: #110
But really, I don't know if anyone is using the internal back-end, or if it is even still working.
So when it will be merged to the base branch? |
@ids1024 Do you have any more suggestions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me.
If anyone wants to quick test this PR, for example downloading this audiostream does not throttle any more:
>>> import pafy
>>> v = pafy.new("https://www.youtube.com/watch?v=YBekU7eHa5E")
>>> audio = v.getbestaudio()
>>> audio.download()
pafy/backend_youtube_dl.py
Outdated
return g.opener.open(url) | ||
|
||
def to_screen(self, *args, **kwargs): | ||
# print(*args, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this anymore though. ;)
I'm merging this since @ritiek had already approved. |
Closes #199