-
-
Notifications
You must be signed in to change notification settings - Fork 124
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
#33 Playlist Support #44
Conversation
Get playlist infos and all videos. No download for now.
@Grodou Hi, great work! Thank you for contributing. I have few suggestions and questions:
|
@sealedtx Hi, thank you for the review. Here come the answers:
Completely agree. I think
Old school style I guess :)
Exactly, 100 videos max. Scrolling to the bottom loads 100 more, and so on.
Just a part of playlist.py. The actual client version we should use is available in the
That playlist is often updated, we can't do reliable tests on its length or content. Still in progress, next step is to make a PlaylistVideo as easy to use as a YoutubeVideo (format selection, downloads, ...). |
@Grodou Thank you for the answers.
Please, make sure you follow current code base style (even if it is not perfect), for easier maintenance in future.
So mb we should implement getOrDefault logic for these values (search them in response, if not found - use default hardcoded)?
Not sure if you should focus on this. I believe that there is no simple way but just |
@sealedtx Hi, here are some answers and suggestions.
It wasn't clear, but of course I will.
Looks like the client version is always in the response, no need for hardcoded value.
I agree, it is sufficient. However, functionalities like these could be handy:
I made a version of it, and since code explains it better than I could, I will soon commit so you can tell if it's interesting or not. |
Download playlist videos as regular videos, and full playlists using filters. Code style fixes
Fix merge conflicts
@sealedtx Here is the version with download available, main changes are listed below. Video hierarchy
Exceptions
Tests
I noticed a strange behaviour: a video can have a specific available format at a time, and a few seconds later, it's gone. Unit tests take care of it and should success any time. Let me know what you think. |
@Grodou Hi, sorry for a long response, I feel busy last days. First of all thank you for a great work! And again suggestions:
I hardly imagine that some one is looking for a videos in playlist only with specific itag or quality. Even so it could be achieved with
Moving last four items into a single one makes code difficult to read and user won't understand what is under the hood (additional http requets), IMHO.
Packages: Waiting for your comments and thoughts. Thank you! |
@sealedtx Hi, thank you for the kind comments, and sorry it took me some time to answer. Lazy loadingSince it's a central part of this version, I think we should agree about it first.
If that so, lazy loading is broken.
In my opinion, this widely used design pattern is completely adapted to this case: it loads data only when it's needed (if ever), and hides any underlying process. Please feel free to tell if you don't want it, I'll keep the version in a branch anyway, just in case. 2 questions I can answer for now:
Video index starts at 1, not 0. Videos seem to be always sorted.
A |
@Grodou Thank you for the answers. Lazy loadingI understand what is lazy loading pattern and why it might be applied here. But I I doubt about hiding from user additional http request, because I know that this library is used by android devs. Due to lazy loading it is not clear that YoutubePlaylist
I think in such case this method can be omitted. Still waiting for your thoughts about shrinking |
@sealedtx Hi, thank you for the helpful informations. Lazy loadingI was wondering why you seemed both interested and reluctant, and just wanted to move on. YoutubePlaylist
Totally agree.
I wanted to know about lazy loading first, because there's a lot to say, as you can see.
Just a poor implementation of mine, it should better catch exceptions and return a list of successfully fetched videos or at least the count of it.
Download
If you're interested by a whole music playlist so you want all the audio tracks, we could then assume that:
So you could either:
and download them all!
Absolutely, but then, you still have to loop over videos, select the same format each time, and download. 2 more ideas for downloads. We could watch progress (for an async task) with a listener like:
We could move the whole download logic to the
Packages
Indeed, a dedicated package for "regular" video would make things clearer. That was a lot of topics, sorry for the longest comment ever :) |
@Grodou Hi! Thank you for your response. Lazy loadingI really appreciate your work done, but unfortunately, I decided not to implement (or at least postpone it) lazy loading for playlist video formats, due to reasons mentioned above. YoutubePlaylist
I prefer to keep simple things done well at first, and leave opportiunity to extend functionally later. If we don't know how it should be implemented to work well - remove it for now, and discuss/add in the further updates. Download
It might be wrong. It is common, that different videos may have different set of formats (it may depend on the period when they were uploaded, quality of the source video, etc). And also youtube make changes from time to time.
User must be aware about what is happening using this library. As I already mentioned, merging these steps into one can lead to unclear situations, errors may occur during fetching meta, or accessing file system, or connection, or downloading. It would be difficult to build such api that properly handles all these possible errors in a single method. I believe user of this library must be responsible for it.
Agree. But I don't want to do changes which break backwards compatibility. There is a lot of work to be done about refactoing, including classes naming, packages structure, shrinking useless methods, extending api, fixing api and code style. But I want it to be released in the 3.x.x version. I will create "refactoring" branch later. I like most of your ideas and you are welcomed to contribute!
Itag - yes, but Extension contains also subtitles formats, not only video. As I said, not in this PR, sorry for starting discussion about refactoring here. So... in conclusion... sorry for being not very clear: In this PR I want to see the most simple functionality for playlist meta extraction, but enough to be useful. It should cover the most common use cases, and it should be clear for user where and which errors may occur. We may discuss further improvements (but no breaking changes in version 2.x.x) after the feature will have already been released and useful for people.
Don't worry, my comment is also not very compact :) |
@sealedtx Hi, that's good news! I think it's a very good decision. So, in order to keep the API as clear and simple as possible, I think:
Like this, things are clear, an item is not a video, and access is more simple: |
@Grodou Sounds good. But let it be |
@sealedtx OK, should the |
@Grodou let it be |
* Lazy loading and download removed * README.md update * Code style fixes
@sealedtx Hi, it's done. Just a few comments:
Hope that's fine. |
@Grodou Perfect! Is everything ready to merge? |
@sealedtx Hi, I forgot one little line... Ready to merge now! Probably not the right place to ask, but I'd like to make a PR for faster downloads. |
@Grodou Thank you.
For sure, and yes, it would be better to explain your thoughts in the issue. |
Get playlist details and all videos.
No download for now.