Skip to content
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

Merged
merged 7 commits into from
Jun 23, 2018

Conversation

vn-ki
Copy link
Member

@vn-ki vn-ki commented Mar 9, 2018

Closes #199

@@ -4,6 +4,7 @@
import time
import logging
import subprocess
import random
Copy link
Member

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?

Copy link
Member Author

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!

@ritiek
Copy link
Member

ritiek commented Mar 15, 2018

I wonder if we should create a new function that returns progress_stats since we are using the same code in two different places (in progress_hook() and in _internal_download().

Anyway, thanks a lot for this! I really hope this gets merged in.

@vn-ki
Copy link
Member Author

vn-ki commented Mar 15, 2018

Thanks for the review! I guess it looks better now!

@@ -24,6 +24,12 @@
from .playlist import get_playlist2
from .util import xenc

try:
import youtube_dl
Copy link
Contributor

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.

@JoshukLite
Copy link

So when it will be merged to the base branch?

@vn-ki
Copy link
Member Author

vn-ki commented May 8, 2018

@ids1024 Do you have any more suggestions?

@vn-ki vn-ki requested review from ritiek and ids1024 June 19, 2018 10:43
Copy link
Member

@ritiek ritiek left a 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()

return g.opener.open(url)

def to_screen(self, *args, **kwargs):
# print(*args, **kwargs)
Copy link
Member

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. ;)

@vn-ki
Copy link
Member Author

vn-ki commented Jun 23, 2018

I'm merging this since @ritiek had already approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants