From dc0ef3b89a5355401afab8c6a0303009c705b935 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Mon, 26 Feb 2018 16:19:58 +0100 Subject: [PATCH] remove unused ExtractionExceptions --- .../schabi/newpipe/extractor/Extractor.java | 2 +- .../newpipe/extractor/ListExtractor.java | 2 +- .../org/schabi/newpipe/extractor/NewPipe.java | 1 - .../newpipe/extractor/StreamingService.java | 7 +-- .../extractor/channel/ChannelExtractor.java | 3 +- .../extractor/playlist/PlaylistExtractor.java | 2 +- .../SoundcloudChannelExtractor.java | 2 +- .../SoundcloudPlaylistExtractor.java | 2 +- .../soundcloud/SoundcloudService.java | 6 +-- .../soundcloud/SoundcloudStreamExtractor.java | 2 +- .../youtube/YoutubeChannelExtractor.java | 4 +- .../youtube/YoutubePlaylistExtractor.java | 2 +- .../services/youtube/YoutubeService.java | 6 +-- .../youtube/YoutubeStreamExtractor.java | 2 +- .../extractor/stream/StreamExtractor.java | 2 +- .../YoutubeStreamExtractorGemaTest.java | 53 ------------------- 16 files changed, 21 insertions(+), 77 deletions(-) delete mode 100644 src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorGemaTest.java diff --git a/src/main/java/org/schabi/newpipe/extractor/Extractor.java b/src/main/java/org/schabi/newpipe/extractor/Extractor.java index d47150464..55901f580 100644 --- a/src/main/java/org/schabi/newpipe/extractor/Extractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/Extractor.java @@ -36,7 +36,7 @@ public abstract class Extractor { private boolean pageFetched = false; private final Downloader downloader; - public Extractor(StreamingService service, String url) throws ExtractionException { + public Extractor(final StreamingService service, final String url) { if(service == null) throw new NullPointerException("service is null"); if(url == null) throw new NullPointerException("url is null"); this.service = service; diff --git a/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java b/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java index 746ab7867..fbe06460f 100644 --- a/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java @@ -14,7 +14,7 @@ public abstract class ListExtractor extends Extractor { /** * Get a new ListExtractor with the given nextPageUrl set. */ - public ListExtractor(StreamingService service, String url) throws ExtractionException { + public ListExtractor(StreamingService service, String url) { super(service, url); } diff --git a/src/main/java/org/schabi/newpipe/extractor/NewPipe.java b/src/main/java/org/schabi/newpipe/extractor/NewPipe.java index 0a6363f1a..a12f38219 100644 --- a/src/main/java/org/schabi/newpipe/extractor/NewPipe.java +++ b/src/main/java/org/schabi/newpipe/extractor/NewPipe.java @@ -28,7 +28,6 @@ import java.util.List; * Provides access to streaming services supported by NewPipe. */ public class NewPipe { - private static final String TAG = NewPipe.class.toString(); private static Downloader downloader = null; private NewPipe() { diff --git a/src/main/java/org/schabi/newpipe/extractor/StreamingService.java b/src/main/java/org/schabi/newpipe/extractor/StreamingService.java index 969e5f089..11e6e9b1a 100644 --- a/src/main/java/org/schabi/newpipe/extractor/StreamingService.java +++ b/src/main/java/org/schabi/newpipe/extractor/StreamingService.java @@ -66,12 +66,13 @@ public abstract class StreamingService { public abstract UrlIdHandler getStreamUrlIdHandler(); public abstract UrlIdHandler getChannelUrlIdHandler(); public abstract UrlIdHandler getPlaylistUrlIdHandler(); + public abstract SearchEngine getSearchEngine(); public abstract SuggestionExtractor getSuggestionExtractor(); - public abstract StreamExtractor getStreamExtractor(String url) throws ExtractionException; + public abstract StreamExtractor getStreamExtractor(String url); public abstract KioskList getKioskList() throws ExtractionException; - public abstract ChannelExtractor getChannelExtractor(String url) throws ExtractionException; - public abstract PlaylistExtractor getPlaylistExtractor(String url) throws ExtractionException; + public abstract ChannelExtractor getChannelExtractor(String url); + public abstract PlaylistExtractor getPlaylistExtractor(String url); public abstract SubscriptionExtractor getSubscriptionExtractor(); /** diff --git a/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java b/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java index 947c77603..4badd5690 100644 --- a/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java @@ -31,8 +31,7 @@ import java.io.IOException; public abstract class ChannelExtractor extends ListExtractor { - public ChannelExtractor(StreamingService service, String url) - throws ExtractionException { + public ChannelExtractor(StreamingService service, String url) { super(service, url); } diff --git a/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistExtractor.java b/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistExtractor.java index a627310c0..c506c5830 100644 --- a/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistExtractor.java @@ -14,7 +14,7 @@ import java.io.IOException; public abstract class PlaylistExtractor extends ListExtractor { - public PlaylistExtractor(StreamingService service, String url) throws ExtractionException { + public PlaylistExtractor(StreamingService service, String url) { super(service, url); } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractor.java index 9795c90e4..c59b7f7b5 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractor.java @@ -21,7 +21,7 @@ public class SoundcloudChannelExtractor extends ChannelExtractor { private StreamInfoItemsCollector streamInfoItemsCollector = null; private String nextPageUrl = null; - public SoundcloudChannelExtractor(StreamingService service, String url) throws ExtractionException { + public SoundcloudChannelExtractor(StreamingService service, String url) { super(service, url); } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractor.java index 8ab6c6d07..ff247d54b 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractor.java @@ -21,7 +21,7 @@ public class SoundcloudPlaylistExtractor extends PlaylistExtractor { private StreamInfoItemsCollector streamInfoItemsCollector = null; private String nextPageUrl = null; - public SoundcloudPlaylistExtractor(StreamingService service, String url) throws ExtractionException { + public SoundcloudPlaylistExtractor(StreamingService service, String url) { super(service, url); } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudService.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudService.java index 58d2171c2..383c0a810 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudService.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudService.java @@ -45,17 +45,17 @@ public class SoundcloudService extends StreamingService { @Override - public StreamExtractor getStreamExtractor(String url) throws ExtractionException { + public StreamExtractor getStreamExtractor(String url) { return new SoundcloudStreamExtractor(this, url); } @Override - public ChannelExtractor getChannelExtractor(String url) throws ExtractionException { + public ChannelExtractor getChannelExtractor(String url) { return new SoundcloudChannelExtractor(this, url); } @Override - public PlaylistExtractor getPlaylistExtractor(String url) throws ExtractionException { + public PlaylistExtractor getPlaylistExtractor(String url) { return new SoundcloudPlaylistExtractor(this, url); } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java index 2abececd3..5819342a7 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java @@ -18,7 +18,7 @@ import java.util.*; public class SoundcloudStreamExtractor extends StreamExtractor { private JsonObject track; - public SoundcloudStreamExtractor(StreamingService service, String url) throws ExtractionException { + public SoundcloudStreamExtractor(StreamingService service, String url) { super(service, url); } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java index 00a376aa0..d4c50fe93 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java @@ -60,10 +60,8 @@ public class YoutubeChannelExtractor extends ChannelExtractor { */ //private boolean fetchingNextStreams; - public YoutubeChannelExtractor(StreamingService service, String url) throws ExtractionException { + public YoutubeChannelExtractor(StreamingService service, String url) { super(service, url); - - //fetchingNextStreams = nextPageUrl != null && !nextPageUrl.isEmpty(); } @Override diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractor.java index d140c64b4..e845c25b0 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractor.java @@ -31,7 +31,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor { */ private Document nextPageAjax; - public YoutubePlaylistExtractor(StreamingService service, String url) throws ExtractionException { + public YoutubePlaylistExtractor(StreamingService service, String url) { super(service, url); } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java index 714c80be2..5e66e124e 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java @@ -65,17 +65,17 @@ public class YoutubeService extends StreamingService { } @Override - public StreamExtractor getStreamExtractor(String url) throws ExtractionException { + public StreamExtractor getStreamExtractor(String url) { return new YoutubeStreamExtractor(this, url); } @Override - public ChannelExtractor getChannelExtractor(String url) throws ExtractionException { + public ChannelExtractor getChannelExtractor(String url) { return new YoutubeChannelExtractor(this, url); } @Override - public PlaylistExtractor getPlaylistExtractor(String url) throws ExtractionException { + public PlaylistExtractor getPlaylistExtractor(String url) { return new YoutubePlaylistExtractor(this, url); } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java index 0fde3cf19..03182568b 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java @@ -85,7 +85,7 @@ public class YoutubeStreamExtractor extends StreamExtractor { private boolean isAgeRestricted; - public YoutubeStreamExtractor(StreamingService service, String url) throws ExtractionException { + public YoutubeStreamExtractor(StreamingService service, String url) { super(service, url); } diff --git a/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java b/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java index b95cff374..a3df7ecfa 100644 --- a/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java @@ -39,7 +39,7 @@ public abstract class StreamExtractor extends Extractor { public static final int NO_AGE_LIMIT = 0; - public StreamExtractor(StreamingService service, String url) throws ExtractionException { + public StreamExtractor(StreamingService service, String url) { super(service, url); } diff --git a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorGemaTest.java b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorGemaTest.java deleted file mode 100644 index 9813dc466..000000000 --- a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorGemaTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.schabi.newpipe.extractor.services.youtube; - -import org.junit.Ignore; -import org.junit.Test; -import org.schabi.newpipe.Downloader; -import org.schabi.newpipe.extractor.NewPipe; -import org.schabi.newpipe.extractor.exceptions.ExtractionException; - -import java.io.IOException; - -import static org.junit.Assert.fail; -import static org.schabi.newpipe.extractor.ServiceList.YouTube; - -/* - * Created by Christian Schabesberger on 30.12.15. - * - * Copyright (C) Christian Schabesberger 2015 - * YoutubeVideoExtractorGema.java is part of NewPipe. - * - * NewPipe is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * NewPipe is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with NewPipe. If not, see . - */ - -/** - * This exception is only thrown in Germany. - *

- * WARNING: Deactivate this Test Case before uploading it to Github, otherwise CI will fail. - */ -public class YoutubeStreamExtractorGemaTest { - - @Test - @Ignore - public void testGemaError() throws IOException, ExtractionException { - try { - NewPipe.init(Downloader.getInstance()); - YouTube.getStreamExtractor("https://www.youtube.com/watch?v=3O1_3zBUKM8"); - - fail("GemaException should be thrown"); - } catch (YoutubeStreamExtractor.GemaException ignored) { - // Exception was thrown, Gema error detection is working. - } - } -}