From 863bf9dc8b66356e7c4f2dee45c6f9df2a0018a7 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Wed, 14 Sep 2016 11:15:08 +0200 Subject: [PATCH 1/2] fix channel has no second page bug --- .../services/youtube/YoutubeChannelExtractor.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java index 021b6a18a..a33707d1c 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java @@ -327,7 +327,12 @@ public class YoutubeChannelExtractor extends ChannelExtractor { private String getNextPageUrl(Document d) throws ParsingException { try { Element button = d.select("button[class*=\"yt-uix-load-more\"]").first(); - return button.attr("abs:data-uix-load-more-href"); + if(button != null) { + return button.attr("abs:data-uix-load-more-href"); + } else { + // sometimes channels are simply so small, they don't have a second/next4q page + return ""; + } } catch(Exception e) { throw new ParsingException("could not load next page url", e); } From efd2ac353e3fea6cc58eec76305b69f5989817c3 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Wed, 14 Sep 2016 11:29:22 +0200 Subject: [PATCH 2/2] fix WORLD_MODE_READABLE bug blub --- .../main/java/org/schabi/newpipe/download/MainActivity.java | 4 ++-- .../java/us/shandian/giga/ui/fragment/MissionsFragment.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/download/MainActivity.java b/app/src/main/java/org/schabi/newpipe/download/MainActivity.java index 1ea6d2024..60b64b1bf 100644 --- a/app/src/main/java/org/schabi/newpipe/download/MainActivity.java +++ b/app/src/main/java/org/schabi/newpipe/download/MainActivity.java @@ -10,6 +10,7 @@ import android.content.ServiceConnection; import android.content.SharedPreferences; import android.os.Bundle; import android.os.IBinder; +import android.preference.PreferenceManager; import android.support.v4.app.NavUtils; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; @@ -95,8 +96,7 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte actionBar.setTitle(R.string.downloads_title); actionBar.setDisplayShowTitleEnabled(true); - //todo: this needs to be fixed Context.MODE_WORLD_READABLE is obsolet - mPrefs = getSharedPreferences(THREADS, Context.MODE_WORLD_READABLE); + mPrefs = PreferenceManager.getDefaultSharedPreferences(this); // Fragment getWindow().getDecorView().getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { diff --git a/app/src/main/java/us/shandian/giga/ui/fragment/MissionsFragment.java b/app/src/main/java/us/shandian/giga/ui/fragment/MissionsFragment.java index c8f0d2fbf..d25f12d65 100644 --- a/app/src/main/java/us/shandian/giga/ui/fragment/MissionsFragment.java +++ b/app/src/main/java/us/shandian/giga/ui/fragment/MissionsFragment.java @@ -9,6 +9,7 @@ import android.content.ServiceConnection; import android.content.SharedPreferences; import android.os.Bundle; import android.os.IBinder; +import android.preference.PreferenceManager; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; @@ -61,8 +62,8 @@ public abstract class MissionsFragment extends Fragment @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.missions, container, false); - - mPrefs = getActivity().getSharedPreferences("mode", Context.MODE_WORLD_READABLE); + + mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); mLinear = mPrefs.getBoolean("linear", false); // Bind the service