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 Sep 6, 2024
1 parent 64ff9cf commit 3c25c3a
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 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,13 @@ 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");
if (host.endsWith("youtube.com") || host.endsWith("youtu.be")) {
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();
.path("uri2addon/").
appendQueryParameter("uri", playUri.toString());
return pluginUri.toString();
}

return null;
Expand Down

0 comments on commit 3c25c3a

Please sign in to comment.