-
Notifications
You must be signed in to change notification settings - Fork 425
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
Add MixInfoItem and extract YouTube mixes in related items #788
Conversation
Actually, I'm not so sure whether |
...g/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorRelatedMixTest.java
Outdated
Show resolved
Hide resolved
...g/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorRelatedMixTest.java
Outdated
Show resolved
Hide resolved
extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java
Outdated
Show resolved
Hide resolved
extractor/src/main/java/org/schabi/newpipe/extractor/InfoItem.java
Outdated
Show resolved
Hide resolved
Yay! Youtube Music mixes! 💃 |
1e86327
to
f05acb0
Compare
I made some changes:
Testing apk: app-debug.zip |
As TiA4f8R pointed out I need to change the videos being tested to non-copyrighted ones |
Every Mix gives me this error: Exception
Crash log
Did no one else encounter this? I didn't bother reporting because I thought you would have come across it instantly. |
} | ||
} | ||
|
||
public static class GenreMix { |
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 could not find another video which suggests me a genre mix, so I won't change these, also because they are autogenerated playlists, not actual possible copyrighted videos
|
||
public class YoutubeStreamExtractorRelatedMixTest extends DefaultStreamExtractorTest { | ||
private static final String RESOURCE_PATH = DownloaderFactory.RESOURCE_PATH + "services/youtube/extractor/stream/"; | ||
static final String ID = "UtF6Jej8yb4"; |
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.
Instead I found an NCS video with a stream mix and a yt music mix in the suggestions, I will use this one: https://www.youtube.com/watch?v=K4DyBUG242c
I changed the copyrighted video to https://www.youtube.com/watch?v=K4DyBUG242c as requested and, since that video also incuded a music mix, I found out music mixes were not being extracted. They were a still different type of recommended item, |
@Stypox The latest APK is from the |
@opusforlife2 I can't reproduce your error, for me they work fine. Also, I'd say it's unrelated to this PR, but I will try to fix it later today and open another PR. |
Progress! Tested Adele's Hello. It's the only video where I got two mixes in related videos instead of just one. One is the regular "Mix - [video name]", which still doesn't work. For all videos that showed me a Mix in related videos, this was the title format. But the other one does! I don't know if you'll get the same suggestion, but it's called "Hip Hop Essentials" and the uploader is shown as "YouTube Music". There's no "Mix" in the title. |
@opusforlife2 yep, the one you found is a YouTube Music Mix and is among the ones I added support for in 098acf2 |
This comment was marked as outdated.
This comment was marked as outdated.
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 just did a cursory review. Since the branch was force pushed I have no idea what exactly is new and old.
Codewise it looks good to me.
Testing apk: app-debug.zip
What exactly can be tested and how? API compatibility?
extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java
Show resolved
Hide resolved
...g/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorRelatedMixTest.java
Show resolved
Hide resolved
Well, you can open music videos on youtube in NewPipe and you can verify that mixes now appear as related items (which is what this PR is almost all about) |
Done @XiangRongLin have you understood what/how you should test? |
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.
have you understood what/how you should test?
Yes. Then LGTM
It is a collector that can handle many extractor types, to be used when a list contains items of different types (e.g. search). It was renamed from InfoItemsSearchCollector so that it can now be used not just for search but for any extractor needing it. It supports, streams, channels, playlists and *mixes*.
Note: genre mixes already worked, now they are just considered as such in various video id extraction and in related items Note 2: now extracting a mix id from a *normal* youtube mix id will fail if the video id wouldn't be exactly 11 characters long
Replaces mix tests based on a strange mix type RDQM{videoId} (only reference I could find is ytdl-org/youtube-dl#26228) and with an invalid video id of 13 characters (the first two characters were QM, but even after removing QM there still wasn't a video available at that id). Also updates mocks.
@XiangRongLin rebased and added |
Woohoo! |
Replaces #685, thank you @opusforlife2 for the ping there ;-)
Changes
This PR adds aSee Add MixInfoItem and extract YouTube mixes in related items #788 (comment)mix
subpackage that contains aMixInfoItem
, i.e. a new type ofInfoItem
separated fromPlaylistInfoItem
that adds an abstractgetMixType
function and nothing else to the plainInfoItem
(since mixes do not have an uploader or a stream count). The mix type can be one of: stream, music, channel (as described here). Themix
subpackage also contains theMixInfoItemCollector
and the baseMixInfoItemExtractor
.InfoItemsSearchCollector
intoMultiInfoItemsCollector
and added support for also collectingMixInfoItemExtractor
s. I could do this since the essence of that class was just to combine some collectors into one, so it had nothing to do with "search" but could be useful everywhere we want to return a list with multiple types of items.YouTubeMixInfoItemExtractor
would have been duplicated withYoutubeStreamInfoItemExtractor
and classes related to mixes, I created some common functions inYouTubeParsingHelper
(the TODO there is unrelated to this PR and was just copied over). Related videos havecompactVideoRenderer
as a key in the json object, while related mixes havecompactRadioRenderer
(note: still untested for channel, music and my mixes)@XiangRongLin what do you think about this? :-)