Skip to content

Commit

Permalink
use uri2addon for yt video parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkucera committed Mar 29, 2024
1 parent 64ff9cf commit e09b304
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions app/src/main/java/org/xbmc/kore/utils/PluginUrlUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,9 @@ public class PluginUrlUtils {
public static String toDefaultYouTubePluginUrl(Uri playUri) {
String host = playUri.getHost();

if (host.endsWith("youtube.com")) {
String videoId = playUri.getQueryParameter("v");
String playlistId = playUri.getQueryParameter("list");
Uri.Builder pluginUri = new Uri.Builder()
.scheme("plugin")
.authority("plugin.video.youtube")
.path("play/");
boolean valid = false;
if (videoId != null) {
valid = true;
pluginUri.appendQueryParameter("video_id", videoId);
}
if (playlistId != null) {
valid = true;
pluginUri.appendQueryParameter("playlist_id", playlistId)
.appendQueryParameter("order", "default");
}
if (valid) {
return pluginUri.build().toString();
}
} else if (host.endsWith("youtu.be")) {
return "plugin://plugin.video.youtube/play/?video_id="
+ playUri.getLastPathSegment();
if (host.endsWith("youtube.com") || host.endsWith("youtu.be")) {
return "plugin://plugin.video.youtube/uri2addon/?uri="
+ playUri.toString();
}

return null;
Expand Down

0 comments on commit e09b304

Please sign in to comment.