From b8a080178606a1e982b2e0bfe9d6c306dcc901f4 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Wed, 14 Sep 2016 00:22:55 +0200 Subject: [PATCH] fixed bug regarding channels acual fix --- app/src/main/java/org/schabi/newpipe/ChannelActivity.java | 8 ++++---- .../services/youtube/YoutubeChannelExtractor.java | 4 ++++ .../java/org/schabi/newpipe/report/ErrorActivity.java | 5 ++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/ChannelActivity.java b/app/src/main/java/org/schabi/newpipe/ChannelActivity.java index 1a574dc99..d5e9b31bb 100644 --- a/app/src/main/java/org/schabi/newpipe/ChannelActivity.java +++ b/app/src/main/java/org/schabi/newpipe/ChannelActivity.java @@ -218,7 +218,7 @@ public class ChannelActivity extends AppCompatActivity { View rootView = findViewById(android.R.id.content); ErrorActivity.reportError(h, ChannelActivity.this, info.errors, null, rootView, - ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_STREAM, + ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_CHANNEL, service.getServiceInfo().name, channelUrl, 0 /* no message for the user */)); } } catch(IOException ioe) { @@ -226,7 +226,7 @@ public class ChannelActivity extends AppCompatActivity { ioe.printStackTrace(); } catch(ParsingException pe) { ErrorActivity.reportError(h, ChannelActivity.this, pe, VideoItemDetailFragment.class, null, - ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_STREAM, + ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_CHANNEL, service.getServiceInfo().name, channelUrl, R.string.parsing_error)); h.post(new Runnable() { @Override @@ -237,7 +237,7 @@ public class ChannelActivity extends AppCompatActivity { pe.printStackTrace(); } catch(ExtractionException ex) { ErrorActivity.reportError(h, ChannelActivity.this, ex, VideoItemDetailFragment.class, null, - ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_STREAM, + ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_CHANNEL, service.getServiceInfo().name, channelUrl, R.string.parsing_error)); h.post(new Runnable() { @Override @@ -248,7 +248,7 @@ public class ChannelActivity extends AppCompatActivity { ex.printStackTrace(); } catch(Exception e) { ErrorActivity.reportError(h, ChannelActivity.this, e, VideoItemDetailFragment.class, null, - ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_STREAM, + ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_CHANNEL, service.getServiceInfo().name, channelUrl, R.string.general_error)); h.post(new Runnable() { @Override 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 d4653d811..021b6a18a 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 @@ -297,6 +297,10 @@ public class YoutubeChannelExtractor extends ChannelExtractor { @Override public String getFeedUrl() throws ParsingException { try { + if(userUrl.contains("channel")) { + //channels don't have feeds in youtube, only user can provide such + return ""; + } if(!isAjaxPage) { feedUrl = doc.select("link[title=\"RSS\"]").first().attr("abs:href"); } diff --git a/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java b/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java index 3cc7791b7..a6f2d9a71 100644 --- a/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java +++ b/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java @@ -132,6 +132,7 @@ public class ErrorActivity extends AppCompatActivity { public static final int USER_REPORT = 4; public static final int LOAD_IMAGE = 5; public static final int UI_ERROR = 6; + public static final int REQUESTED_CHANNEL = 7; // MESSAGE STRING public static final String SEARCHED_STRING = "searched"; @@ -141,7 +142,7 @@ public class ErrorActivity extends AppCompatActivity { public static final String USER_REPORT_STRING = "user report"; public static final String LOAD_IMAGE_STRING = "load image"; public static final String UI_ERROR_STRING = "ui error"; - + public static final String REQUESTED_CHANNEL_STRING = "requested channel"; public static final String ERROR_EMAIL_ADDRESS = "crashreport@newpipe.schabi.org"; public static final String ERROR_EMAIL_SUBJECT = "Exception in NewPipe " + BuildConfig.VERSION_NAME; @@ -426,6 +427,8 @@ public class ErrorActivity extends AppCompatActivity { return LOAD_IMAGE_STRING; case UI_ERROR: return UI_ERROR_STRING; + case REQUESTED_CHANNEL: + return REQUESTED_CHANNEL_STRING; default: return "Your description is in another castle."; }