handle youtube.com in app
This commit is contained in:
parent
d443fc74bf
commit
aa25a77d5f
@ -10,8 +10,8 @@ android {
|
||||
applicationId "it.purser.stream"
|
||||
minSdkVersion 25
|
||||
targetSdkVersion 29
|
||||
versionCode 104
|
||||
versionName "104.0"
|
||||
versionCode 106
|
||||
versionName "106.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
@ -11,6 +11,9 @@ public class ShareActivity extends Activity {
|
||||
private Uri getSharedLink() {
|
||||
HashSet<String> domains = new HashSet<>();
|
||||
domains.add("youtu.be");
|
||||
domains.add("youtube.com");
|
||||
domains.add("www.youtube.com");
|
||||
domains.add("tv.nrk.no");
|
||||
|
||||
Intent intent = getIntent();
|
||||
Bundle bundle = intent.getExtras();
|
||||
@ -20,6 +23,16 @@ public class ShareActivity extends Activity {
|
||||
Uri uri = Uri.parse(txt);
|
||||
String host = uri.getHost().toLowerCase(Locale.ROOT);
|
||||
if(domains.contains(host)) {
|
||||
if(host.contains("youtube.com")) {
|
||||
Uri.Builder builder = new Uri.Builder();
|
||||
builder.authority(host);
|
||||
builder.scheme("https");
|
||||
String path = uri.getQueryParameter("v");
|
||||
if(path != null) {
|
||||
builder.path(path);
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
return uri;
|
||||
}
|
||||
} catch(Exception e) {}
|
||||
|
Loading…
Reference in New Issue
Block a user