diff --git a/extractor/src/test/java/org/schabi/newpipe/downloader/DownloaderFactory.java b/extractor/src/test/java/org/schabi/newpipe/downloader/DownloaderFactory.java index 6799a9150..db805e6bb 100644 --- a/extractor/src/test/java/org/schabi/newpipe/downloader/DownloaderFactory.java +++ b/extractor/src/test/java/org/schabi/newpipe/downloader/DownloaderFactory.java @@ -10,6 +10,14 @@ public class DownloaderFactory { private final static DownloaderType DEFAULT_DOWNLOADER = DownloaderType.REAL; + public static DownloaderType getDownloaderType() { + try { + return DownloaderType.valueOf(System.getProperty("downloader")); + } catch (final Exception e) { + return DEFAULT_DOWNLOADER; + } + } + /** *
* Returns a implementation of a {@link Downloader}. @@ -28,14 +36,8 @@ public class DownloaderFactory { * @param path The path to the folder where mocks are saved/retrieved. * Preferably starting with {@link DownloaderFactory#RESOURCE_PATH} */ - public Downloader getDownloader(String path) throws IOException { - DownloaderType type; - try { - type = DownloaderType.valueOf(System.getProperty("downloader")); - } catch (Exception e) { - type = DEFAULT_DOWNLOADER; - } - + public static Downloader getDownloader(final String path) throws IOException { + final DownloaderType type = getDownloaderType(); switch (type) { case REAL: return DownloaderTestImpl.getInstance(); @@ -44,7 +46,7 @@ public class DownloaderFactory { case RECORDING: return new RecordingDownloader(path); default: - throw new UnsupportedOperationException("Unknown downloader type: " + type.toString()); + throw new UnsupportedOperationException("Unknown downloader type: " + type); } } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java index 98283068f..94966913b 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java @@ -35,7 +35,7 @@ public class YoutubeChannelExtractorTest { public static void setUp() throws IOException { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "notAvailable")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "notAvailable")); } @Test @@ -132,7 +132,7 @@ public class YoutubeChannelExtractorTest { public static void setUp() throws IOException { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "notSupported")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "notSupported")); } @Test @@ -151,7 +151,7 @@ public class YoutubeChannelExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "gronkh")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "gronkh")); extractor = (YoutubeChannelExtractor) YouTube .getChannelExtractor("http://www.youtube.com/user/Gronkh"); extractor.fetchPage(); @@ -248,7 +248,7 @@ public class YoutubeChannelExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "VSauce")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "VSauce")); extractor = (YoutubeChannelExtractor) YouTube .getChannelExtractor("https://www.youtube.com/user/Vsauce"); extractor.fetchPage(); @@ -344,7 +344,7 @@ public class YoutubeChannelExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "kurzgesagt")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "kurzgesagt")); extractor = (YoutubeChannelExtractor) YouTube .getChannelExtractor("https://www.youtube.com/channel/UCsXVk37bltHxD1rDPwtNM8Q"); extractor.fetchPage(); @@ -461,7 +461,7 @@ public class YoutubeChannelExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "captainDisillusion")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "captainDisillusion")); extractor = (YoutubeChannelExtractor) YouTube .getChannelExtractor("https://www.youtube.com/user/CaptainDisillusion/videos"); extractor.fetchPage(); @@ -556,7 +556,7 @@ public class YoutubeChannelExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "random")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "random")); extractor = (YoutubeChannelExtractor) YouTube .getChannelExtractor("https://www.youtube.com/channel/UCUaQMQS9lY5lit3vurpXQ6w"); extractor.fetchPage(); diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelLocalizationTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelLocalizationTest.java index 0c64b0b77..5cf41a769 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelLocalizationTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelLocalizationTest.java @@ -32,7 +32,7 @@ public class YoutubeChannelLocalizationTest { public void testAllSupportedLocalizations() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "localization")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "localization")); testLocalizationsFor("https://www.youtube.com/user/NBCNews"); testLocalizationsFor("https://www.youtube.com/channel/UCcmpeVbSSQlZRvHfdC-CRwg/videos"); diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeCommentsExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeCommentsExtractorTest.java index 6ea11a4d4..2c5119d5f 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeCommentsExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeCommentsExtractorTest.java @@ -40,7 +40,7 @@ public class YoutubeCommentsExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "thomas")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "thomas")); extractor = (YoutubeCommentsExtractor) YouTube .getCommentsExtractor(url); extractor.fetchPage(); @@ -129,7 +129,7 @@ public class YoutubeCommentsExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "empty")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "empty")); extractor = (YoutubeCommentsExtractor) YouTube .getCommentsExtractor(url); extractor.fetchPage(); @@ -169,7 +169,7 @@ public class YoutubeCommentsExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "hearted")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "hearted")); extractor = (YoutubeCommentsExtractor) YouTube .getCommentsExtractor(url); extractor.fetchPage(); @@ -212,7 +212,7 @@ public class YoutubeCommentsExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "pinned")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "pinned")); extractor = (YoutubeCommentsExtractor) YouTube .getCommentsExtractor(url); extractor.fetchPage(); @@ -254,7 +254,7 @@ public class YoutubeCommentsExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "likes")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "likes")); extractor = (YoutubeCommentsExtractor) YouTube .getCommentsExtractor(url); extractor.fetchPage(); @@ -286,7 +286,7 @@ public class YoutubeCommentsExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "localized_vote_count")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "localized_vote_count")); extractor = (YoutubeCommentsExtractor) YouTube .getCommentsExtractor(url); // Force non english local here @@ -315,7 +315,7 @@ public class YoutubeCommentsExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "replies")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "replies")); extractor = (YoutubeCommentsExtractor) YouTube .getCommentsExtractor(url); extractor.fetchPage(); diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeFeedExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeFeedExtractorTest.java index 2ee116b21..ef1605641 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeFeedExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeFeedExtractorTest.java @@ -30,7 +30,7 @@ public class YoutubeFeedExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH)); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH)); extractor = (YoutubeFeedExtractor) YouTube .getFeedExtractor("https://www.youtube.com/user/Kurzgesagt"); extractor.fetchPage(); @@ -84,7 +84,7 @@ public class YoutubeFeedExtractorTest { @BeforeAll public static void setUp() throws IOException { - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "notAvailable/")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "notAvailable/")); } @Test diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeKioskExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeKioskExtractorTest.java index f247566e2..23db8a580 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeKioskExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeKioskExtractorTest.java @@ -26,7 +26,7 @@ public class YoutubeKioskExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "trending")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "trending")); extractor = (YoutubeTrendingExtractor) YouTube.getKioskList().getDefaultKioskExtractor(); extractor.fetchPage(); } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java index ff415b920..ceb5852c9 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeMixPlaylistExtractorTest.java @@ -41,7 +41,7 @@ public class YoutubeMixPlaylistExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "mix")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "mix")); dummyCookie.put(YoutubeMixPlaylistExtractor.COOKIE_NAME, "whatever"); extractor = (YoutubeMixPlaylistExtractor) YouTube .getPlaylistExtractor("https://www.youtube.com/watch?v=" + VIDEO_ID @@ -131,7 +131,7 @@ public class YoutubeMixPlaylistExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "mixWithIndex")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "mixWithIndex")); dummyCookie.put(YoutubeMixPlaylistExtractor.COOKIE_NAME, "whatever"); extractor = (YoutubeMixPlaylistExtractor) YouTube .getPlaylistExtractor("https://www.youtube.com/watch?v=" + VIDEO_ID_NUMBER_4 @@ -212,7 +212,7 @@ public class YoutubeMixPlaylistExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "myMix")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "myMix")); dummyCookie.put(YoutubeMixPlaylistExtractor.COOKIE_NAME, "whatever"); extractor = (YoutubeMixPlaylistExtractor) YouTube .getPlaylistExtractor("https://www.youtube.com/watch?v=" + VIDEO_ID @@ -297,7 +297,7 @@ public class YoutubeMixPlaylistExtractorTest { public static void setUp() throws IOException { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "invalid")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "invalid")); dummyCookie.put(YoutubeMixPlaylistExtractor.COOKIE_NAME, "whatever"); } @@ -332,7 +332,7 @@ public class YoutubeMixPlaylistExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "channelMix")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "channelMix")); dummyCookie.put(YoutubeMixPlaylistExtractor.COOKIE_NAME, "whatever"); extractor = (YoutubeMixPlaylistExtractor) YouTube .getPlaylistExtractor("https://www.youtube.com/watch?v=" + VIDEO_ID_OF_CHANNEL diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelperTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelperTest.java index 7ae7d4d15..45643ec03 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelperTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelperTest.java @@ -21,7 +21,7 @@ public class YoutubeParsingHelperTest { public static void setUp() throws IOException { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "youtubeParsingHelper")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "youtubeParsingHelper")); } @Test diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java index fdd919387..e0b9a205b 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java @@ -42,7 +42,7 @@ public class YoutubePlaylistExtractorTest { public static void setUp() throws IOException { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "notAvailable")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "notAvailable")); } @Test @@ -67,7 +67,7 @@ public class YoutubePlaylistExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "TimelessPopHits")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "TimelessPopHits")); extractor = (YoutubePlaylistExtractor) YouTube .getPlaylistExtractor("http://www.youtube.com/watch?v=lp-EO5I60KA&list=PLMC9KNkIncKtPzgY-5rmhvj7fax8fdxoj"); extractor.fetchPage(); @@ -170,7 +170,7 @@ public class YoutubePlaylistExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "huge")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "huge")); extractor = (YoutubePlaylistExtractor) YouTube .getPlaylistExtractor("https://www.youtube.com/watch?v=8SbUC-UaAxE&list=PLWwAypAcFRgKAIIFqBr9oy-ZYZnixa_Fj"); extractor.fetchPage(); @@ -289,7 +289,7 @@ public class YoutubePlaylistExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "learning")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "learning")); extractor = (YoutubePlaylistExtractor) YouTube .getPlaylistExtractor("https://www.youtube.com/playlist?list=PL8dPuuaLjXtOAKed_MxxWBNaPno5h3Zs8"); extractor.fetchPage(); @@ -392,7 +392,7 @@ public class YoutubePlaylistExtractorTest { public static void setUp() throws IOException { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "continuations")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "continuations")); } @Test diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSuggestionExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSuggestionExtractorTest.java index dd9d5b176..1855f8a03 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSuggestionExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSuggestionExtractorTest.java @@ -47,7 +47,7 @@ public class YoutubeSuggestionExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + ""), new Localization("de", "DE")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + ""), new Localization("de", "DE")); suggestionExtractor = YouTube.getSuggestionExtractor(); } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingKioskInfoTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingKioskInfoTest.java index b11a2f068..164ffc8f5 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingKioskInfoTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingKioskInfoTest.java @@ -48,7 +48,7 @@ public class YoutubeTrendingKioskInfoTest { throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH)); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH)); LinkHandlerFactory LinkHandlerFactory = ((StreamingService) YouTube).getKioskList().getListLinkHandlerFactoryByType("Trending"); kioskInfo = KioskInfo.getInfo(YouTube, LinkHandlerFactory.fromId("Trending").getUrl()); diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchExtractorTest.java index 3a1de7ebe..8b5aaf655 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchExtractorTest.java @@ -41,7 +41,7 @@ public class YoutubeSearchExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "all")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "all")); extractor = YouTube.getSearchExtractor(QUERY); extractor.fetchPage(); } @@ -64,7 +64,7 @@ public class YoutubeSearchExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "channel")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "channel")); extractor = YouTube.getSearchExtractor(QUERY, singletonList(CHANNELS), ""); extractor.fetchPage(); } @@ -89,7 +89,7 @@ public class YoutubeSearchExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "playlist")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "playlist")); extractor = YouTube.getSearchExtractor(QUERY, singletonList(PLAYLISTS), ""); extractor.fetchPage(); } @@ -114,7 +114,7 @@ public class YoutubeSearchExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "videos")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "videos")); extractor = YouTube.getSearchExtractor(QUERY, singletonList(VIDEOS), ""); extractor.fetchPage(); } @@ -140,7 +140,7 @@ public class YoutubeSearchExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "suggestions")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "suggestions")); extractor = YouTube.getSearchExtractor(QUERY, singletonList(VIDEOS), ""); extractor.fetchPage(); } @@ -165,7 +165,7 @@ public class YoutubeSearchExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "corrected")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "corrected")); extractor = YouTube.getSearchExtractor(QUERY, singletonList(VIDEOS), ""); extractor.fetchPage(); } @@ -190,7 +190,7 @@ public class YoutubeSearchExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "random")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "random")); extractor = YouTube.getSearchExtractor(QUERY); extractor.fetchPage(); } @@ -226,7 +226,7 @@ public class YoutubeSearchExtractorTest { public void duplicatedItemsCheck() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "paging")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "paging")); final SearchExtractor extractor = YouTube.getSearchExtractor("cirque du soleil", singletonList(VIDEOS), ""); extractor.fetchPage(); @@ -245,7 +245,7 @@ public class YoutubeSearchExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "metaInfo")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "metaInfo")); extractor = YouTube.getSearchExtractor(QUERY, singletonList(VIDEOS), ""); extractor.fetchPage(); } @@ -282,7 +282,7 @@ public class YoutubeSearchExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "verified")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "verified")); extractor = YouTube.getSearchExtractor(QUERY, singletonList(CHANNELS), ""); extractor.fetchPage(); } @@ -320,7 +320,7 @@ public class YoutubeSearchExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "video_uploader_avatar")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "video_uploader_avatar")); extractor = YouTube.getSearchExtractor(QUERY, singletonList(VIDEOS), ""); extractor.fetchPage(); } @@ -352,7 +352,7 @@ public class YoutubeSearchExtractorTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "video_description")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "video_description")); extractor = YouTube.getSearchExtractor(QUERY, singletonList(VIDEOS), ""); extractor.fetchPage(); } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorAgeRestrictedTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorAgeRestrictedTest.java index 1ac7b5c1e..b907bcec6 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorAgeRestrictedTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorAgeRestrictedTest.java @@ -30,7 +30,7 @@ public class YoutubeStreamExtractorAgeRestrictedTest extends DefaultStreamExtrac YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); YoutubeStreamExtractor.resetDeobfuscationCode(); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "ageRestricted")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "ageRestricted")); extractor = YouTube.getStreamExtractor(URL); extractor.fetchPage(); } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorControversialTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorControversialTest.java index 73d7648aa..51bbbecda 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorControversialTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorControversialTest.java @@ -34,7 +34,7 @@ public class YoutubeStreamExtractorControversialTest extends DefaultStreamExtrac YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); YoutubeStreamExtractor.resetDeobfuscationCode(); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "controversial")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "controversial")); extractor = YouTube.getStreamExtractor(URL); extractor.fetchPage(); } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java index 67e80c297..e8681e5b4 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorDefaultTest.java @@ -65,7 +65,7 @@ public class YoutubeStreamExtractorDefaultTest { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); YoutubeStreamExtractor.resetDeobfuscationCode(); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "notAvailable")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "notAvailable")); } @Test @@ -122,7 +122,7 @@ public class YoutubeStreamExtractorDefaultTest { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); YoutubeStreamExtractor.resetDeobfuscationCode(); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "pewdiwpie")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "pewdiwpie")); extractor = YouTube.getStreamExtractor(URL); extractor.fetchPage(); } @@ -167,7 +167,7 @@ public class YoutubeStreamExtractorDefaultTest { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); YoutubeStreamExtractor.resetDeobfuscationCode(); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "unboxing")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "unboxing")); extractor = YouTube.getStreamExtractor(URL); extractor.fetchPage(); } @@ -222,7 +222,7 @@ public class YoutubeStreamExtractorDefaultTest { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); YoutubeStreamExtractor.resetDeobfuscationCode(); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "ratingsDisabled")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "ratingsDisabled")); extractor = YouTube.getStreamExtractor(URL); extractor.fetchPage(); } @@ -260,7 +260,7 @@ public class YoutubeStreamExtractorDefaultTest { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); YoutubeStreamExtractor.resetDeobfuscationCode(); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "streamSegmentsTagesschau")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "streamSegmentsTagesschau")); extractor = YouTube.getStreamExtractor(URL); extractor.fetchPage(); } @@ -323,7 +323,7 @@ public class YoutubeStreamExtractorDefaultTest { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); YoutubeStreamExtractor.resetDeobfuscationCode(); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "streamSegmentsMaiLab")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "streamSegmentsMaiLab")); extractor = YouTube.getStreamExtractor(URL); extractor.fetchPage(); } @@ -392,7 +392,7 @@ public class YoutubeStreamExtractorDefaultTest { public static void setUp() throws Exception { YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "publicBroadcast")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "publicBroadcast")); extractor = YouTube.getStreamExtractor(URL); YoutubeStreamExtractor.resetDeobfuscationCode(); extractor.fetchPage(); diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorLivestreamTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorLivestreamTest.java index 3a3e7f0bb..2ec365822 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorLivestreamTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorLivestreamTest.java @@ -31,7 +31,7 @@ public class YoutubeStreamExtractorLivestreamTest extends DefaultStreamExtractor YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); YoutubeStreamExtractor.resetDeobfuscationCode(); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "live")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "live")); extractor = YouTube.getStreamExtractor(URL); extractor.fetchPage(); } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorUnlistedTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorUnlistedTest.java index a3f2b0b21..634391d07 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorUnlistedTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/stream/YoutubeStreamExtractorUnlistedTest.java @@ -30,7 +30,7 @@ public class YoutubeStreamExtractorUnlistedTest extends DefaultStreamExtractorTe YoutubeParsingHelper.resetClientVersionAndKey(); YoutubeParsingHelper.setNumberGenerator(new Random(1)); YoutubeStreamExtractor.resetDeobfuscationCode(); - NewPipe.init(new DownloaderFactory().getDownloader(RESOURCE_PATH + "unlisted")); + NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "unlisted")); extractor = YouTube.getStreamExtractor(URL); extractor.fetchPage(); }