Skip to content

Conversation

@XiangRongLin
Copy link
Collaborator

@XiangRongLin XiangRongLin commented Feb 2, 2020

  • I carefully read the contribution guidelines and agree to them.
  • I did test the API against NewPipe.
  • I agree to ASAP create a PULL request for NewPipe for making in compatible when I changed the api.

closes TeamNewPipe/NewPipe#2895

Problem

As describes in the issue in the NewPipe repo, when sharing a youtube mix to newpipe, it crashes. Reason for that is that the linkhandler receives (1)"https://www.youtube.com/watch?v=QXCE3Betyug&list=RDQXCE3Betyug" and converts it to (2)"https://www.youtube.com/playlist?list=RDQXCE3Betyug", which loads a basicly empty page.

Changes

  • The LinkHandler doesn't convert mix urls.
  • New PlaylistExtractor to extract playlist information from the url (1).
  • The YoutubeService uses the new extractor if it is a mix.

Testing

I tested the changes on my android 10 and 7.1 devices and a 5.0 emulator, by:

  • sharing a link from my browser to NewPipe
  • saving the playlist and opening it from the bookmarks fragment
  • playling the playlist (didn't play on 5.0 emulator, but i can't play ANY video here)

This doesn't require changes in the app, besides updating the extractor dependency.

app-debug.zip

What's missing

  • Mixes are generated based on the user. Meaning if I open the site once while logged in and once while in incognito mode, it gives me different playlists.
  • Mixes on youtube are endless but i couldn't find a link for the continuation
  • A lot of other fields are not present in the html, so i just return empty strings or 0

Notes

  • In the mix url (1) above you can see the playlist id is just the video id with "RD" at the start.
    All mix urls that i found so far are like that, where the playlist id is "RD" + video id of the first video. I assume RD stands for radio (Playlist ids start with "PL" instead)

-New YoutubeMixPlaylistExtractor, that extracts from a mix (auto-generated playlist).
-The url has the format of "youtube.com/watch?v=videoID&playlistID",
where playlistID always starts with "RD" and usually followed by the videoID.
-Change YoutubePlaylistLinkHandlerFactory to create a linkhandler with the given url if it is a mix.
-Change YoutubeService to return YoutubeMixPlaylistExtractor if the url is a mix.
@TobiGr TobiGr added the youtube service, https://www.youtube.com/ label Feb 2, 2020
@Override
public String getUploaderName() {
//Youtube mix are auto-generated
return "";
Copy link
Member

@B0pol B0pol Feb 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return YouTube instead of empty String.
See this screenshot, on YouTube website (look at top left):
YouTube_mix

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have that YouTube string marked in you image when i open the site.

But that could also be changed in the app, since there was already a PR to deal with playlists without uploader. Just the String resource would need to be changed.
TeamNewPipe/NewPipe#2724

}

@Override
public String getUploaderAvatarUrl() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As they are generated by YouTube, shouldn't you return YouTube logo (or censored version)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably need to hardcode the url, since i can't find one in the crawled html.
Another way would be to save it as a resource in the app and load from there, but that will probably cause license issues.

This occurs when sharing a mix from the official youtube app.
@XiangRongLin
Copy link
Collaborator Author

With #258 coming soon, I will probably need to adjust my code to the new user agent. Before that I would like to know if the general approach is ok.

@B0pol B0pol mentioned this pull request Mar 2, 2020
3 tasks
@Stypox
Copy link
Member

Stypox commented Mar 3, 2020

@XiangRongLin the general approach seems good to me. But ask @wb9688 to be sure ;-)

@XiangRongLin
Copy link
Collaborator Author

An idea on how to make it endless would be requesting a new mix from YouTube with the last video as the starting point.

I'll check out on the weekend, if it works and whether there are too many duplicates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

youtube service, https://www.youtube.com/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[YouTube] Auto-generated playlist/mix: null on getName()

4 participants