diff --git a/app/build.gradle b/app/build.gradle index 87e7b79e1..488012afc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "org.schabi.newpipe" minSdkVersion 15 targetSdkVersion 25 - versionCode 22 - versionName "0.8.8" + versionCode 23 + versionName "0.8.9" } buildTypes { release { @@ -32,10 +32,10 @@ android { dependencies { testCompile 'junit:junit:4.12' - compile 'com.android.support:appcompat-v7:25.1.0' - compile 'com.android.support:support-v4:25.1.0' - compile 'com.android.support:design:25.1.0' - compile 'com.android.support:recyclerview-v7:25.1.0' + compile 'com.android.support:appcompat-v7:25.1.1' + compile 'com.android.support:support-v4:25.1.1' + compile 'com.android.support:design:25.1.1' + compile 'com.android.support:recyclerview-v7:25.1.1' compile 'org.jsoup:jsoup:1.8.3' compile 'org.mozilla:rhino:1.7.7' compile 'info.guardianproject.netcipher:netcipher:1.2' diff --git a/app/src/main/java/org/schabi/newpipe/ChannelActivity.java b/app/src/main/java/org/schabi/newpipe/ChannelActivity.java index 71e02c197..e64605218 100644 --- a/app/src/main/java/org/schabi/newpipe/ChannelActivity.java +++ b/app/src/main/java/org/schabi/newpipe/ChannelActivity.java @@ -73,8 +73,9 @@ public class ChannelActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { - if (Objects.equals(PreferenceManager.getDefaultSharedPreferences(this) - .getString("theme", getResources().getString(R.string.light_theme_title)), getResources().getString(R.string.dark_theme_title))) { + if (PreferenceManager.getDefaultSharedPreferences(this) + .getString("theme", getResources().getString(R.string.light_theme_title)). + equals(getResources().getString(R.string.dark_theme_title))) { setTheme(R.style.DarkTheme_NoActionBar); } super.onCreate(savedInstanceState); diff --git a/app/src/main/java/org/schabi/newpipe/ThemableActivity.java b/app/src/main/java/org/schabi/newpipe/ThemableActivity.java index 425801676..81789ec1c 100644 --- a/app/src/main/java/org/schabi/newpipe/ThemableActivity.java +++ b/app/src/main/java/org/schabi/newpipe/ThemableActivity.java @@ -1,21 +1,19 @@ package org.schabi.newpipe; +import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v7.app.AppCompatActivity; -import java.util.Objects; - -import static org.schabi.newpipe.R.attr.theme; - public class ThemableActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - if (Objects.equals(PreferenceManager.getDefaultSharedPreferences(this) - .getString("theme", getResources().getString(R.string.light_theme_title)), getResources().getString(R.string.dark_theme_title))) { - setTheme(R.style.DarkTheme); + if (PreferenceManager.getDefaultSharedPreferences(this) + .getString("theme", getResources().getString(R.string.light_theme_title)). + equals(getResources().getString(R.string.dark_theme_title))) { + setTheme(R.style.DarkTheme); } } } \ No newline at end of file diff --git a/app/src/main/java/org/schabi/newpipe/detail/StreamInfoWorker.java b/app/src/main/java/org/schabi/newpipe/detail/StreamInfoWorker.java index dd1ae9f5a..17a4572bd 100644 --- a/app/src/main/java/org/schabi/newpipe/detail/StreamInfoWorker.java +++ b/app/src/main/java/org/schabi/newpipe/detail/StreamInfoWorker.java @@ -125,10 +125,13 @@ public class StreamInfoWorker { e.printStackTrace(); } catch (YoutubeStreamExtractor.DecryptException de) { // custom service related exceptions + ErrorActivity.reportError(h, a, de, VideoItemDetailFragment.class, null, + ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_STREAM, + service.getServiceInfo().name, videoUrl, R.string.youtube_signature_decryption_error)); h.post(new Runnable() { @Override public void run() { - onStreamInfoReceivedListener.onError(R.string.youtube_signature_decryption_error); + a.finish(); } }); de.printStackTrace(); diff --git a/app/src/main/java/org/schabi/newpipe/detail/VideoItemDetailFragment.java b/app/src/main/java/org/schabi/newpipe/detail/VideoItemDetailFragment.java index 8efd549a2..eb75dfa6d 100644 --- a/app/src/main/java/org/schabi/newpipe/detail/VideoItemDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/detail/VideoItemDetailFragment.java @@ -144,6 +144,7 @@ public class VideoItemDetailFragment extends Fragment { TextView similarTitle = (TextView) activity.findViewById(R.id.detail_similar_title); Button backgroundButton = (Button) activity.findViewById(R.id.detail_stream_thumbnail_window_background_button); + View thumbnailView = activity.findViewById(R.id.detail_thumbnail_view); View topView = activity.findViewById(R.id.detailTopView); Button channelButton = (Button) activity.findViewById(R.id.channel_button); @@ -275,6 +276,14 @@ public class VideoItemDetailFragment extends Fragment { } }); + //todo: make backgroundButton handle this + thumbnailView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + playVideo(info); + } + }); + if (info.channel_url != null && info.channel_url != "") { channelButton.setOnClickListener(new View.OnClickListener() { @Override diff --git a/app/src/main/java/org/schabi/newpipe/extractor/Parser.java b/app/src/main/java/org/schabi/newpipe/extractor/Parser.java index b68d01fa7..8e70f751c 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/Parser.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/Parser.java @@ -42,15 +42,23 @@ public class Parser { } public static String matchGroup1(String pattern, String input) throws RegexException { + return matchGroup(pattern, input, 1); + } + + public static String matchGroup(String pattern, String input, int group) throws RegexException { Pattern pat = Pattern.compile(pattern); Matcher mat = pat.matcher(input); boolean foundMatch = mat.find(); if (foundMatch) { - return mat.group(1); + return mat.group(group); } else { //Log.e(TAG, "failed to find pattern \""+pattern+"\" inside of \""+input+"\""); - throw new RegexException("failed to find pattern \""+pattern+" inside of "+input+"\""); + if(input.length() > 1024) { + throw new RegexException("failed to find pattern \""+pattern); + } else { + throw new RegexException("failed to find pattern \"" + pattern + " inside of " + input + "\""); + } } } diff --git a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java index 63642e973..6dd0daa7c 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java @@ -791,10 +791,15 @@ public class YoutubeStreamExtractor extends StreamExtractor { try { Downloader downloader = NewPipe.getDownloader(); + if(!playerUrl.contains("https://youtube.com")) { + //sometimes the https://youtube.com part does not get send with + //than we have to add it by hand + playerUrl = "https://youtube.com" + playerUrl; + } String playerCode = downloader.download(playerUrl); decryptionFuncName = - Parser.matchGroup1("\\.sig\\|\\|([a-zA-Z0-9$]+)\\(", playerCode); + Parser.matchGroup("([\"\\'])signature\\1\\s*,\\s*([a-zA-Z0-9$]+)\\(", playerCode, 2); String functionPattern = "(" + decryptionFuncName.replace("$", "\\$") diff --git a/app/src/main/java/org/schabi/newpipe/settings/SettingsActivity.java b/app/src/main/java/org/schabi/newpipe/settings/SettingsActivity.java index be4dbfc03..7765f9653 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/SettingsActivity.java +++ b/app/src/main/java/org/schabi/newpipe/settings/SettingsActivity.java @@ -46,9 +46,10 @@ public class SettingsActivity extends PreferenceActivity { @Override protected void onCreate(Bundle savedInstanceBundle) { - if (Objects.equals(PreferenceManager.getDefaultSharedPreferences(this) - .getString("theme", getResources().getString(R.string.light_theme_title)), getResources().getString(R.string.dark_theme_title))) { - setTheme(R.style.DarkTheme); + if (PreferenceManager.getDefaultSharedPreferences(this) + .getString("theme", getResources().getString(R.string.light_theme_title)). + equals(getResources().getString(R.string.dark_theme_title))) { + setTheme(R.style.DarkTheme); } getDelegate().installViewFactory(); getDelegate().onCreate(savedInstanceBundle); diff --git a/app/src/main/res/layout/activity_error.xml b/app/src/main/res/layout/activity_error.xml index 478c5218c..891dfe548 100644 --- a/app/src/main/res/layout/activity_error.xml +++ b/app/src/main/res/layout/activity_error.xml @@ -42,7 +42,7 @@ android:id="@+id/errorMessageView" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="?android:attr/colorAccent" + android:textColor="?attr/colorAccent" android:text="@string/info_labels"/>