-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[FR] Search #1001
Comments
Thank you for contributing to PyTube. Please remember to reference Contributing.md |
i will port the code from https://github.com/HelloChatterbox/youtube_searcher over to this repo |
I'm working on this feature now. Expect search functionality to be added soon. |
I think I have the functionality written, feel free to test out the branch I created. It currently only supports video search results, but at a future point in time it could also probably support playlist results fairly easily. I don't plan to merge this for at least a little while so that I can make sure it works how I want it too, to add documentation for the new feature, and to make sure there's nothing else I want to bundle with the update. However, you're welcome to try out the development branch for it in my fork |
Please tell me how to stop the download? Is there a special method? |
What do you mean by stopping the download? |
Now YouTube limits the download speed if you download, for example, a playlist. If the speed drops a lot, then I want to programmatically stop rutube.YouTube(url).streams.first().download(). Is there a method for this? |
One way you could do this is by adjusting the default download chunk size to be smaller, and using an import pytube
pytube.request.default_range_size = 524288 # 0.5MB
def progress_func(data_chunk, bytes_remaining):
# Check when last called and raise an exception here
...
p = Playlist(url)
for url in p.video_urls:
video = YouTube(url, on_progress_callback=progress_func)
video.streams.first().download() |
Will this help solve the problem with the YouTube speed limit? |
No; i'm working on trying to fix the problem with the speed limit. If you want to test it, you can try using this experimental branch that I just got working this morning, but haven't had the chance to test extensively. |
pytube.request.default_range_size = 524288 # 0.5MB |
It would be cool to have some sort of youtube search (videos/playlists) API in pytube.
The text was updated successfully, but these errors were encountered: