Merge pull request #816 from Stypox/mock-only-extension
Add `@MockOnly` Junit 5 extension
This commit is contained in:
commit
d8f2031619
|
@ -6,9 +6,17 @@ import java.io.IOException;
|
|||
|
||||
public class DownloaderFactory {
|
||||
|
||||
public final static String RESOURCE_PATH = "src/test/resources/org/schabi/newpipe/extractor/";
|
||||
public static final String RESOURCE_PATH = "src/test/resources/org/schabi/newpipe/extractor/";
|
||||
|
||||
private final static DownloaderType DEFAULT_DOWNLOADER = DownloaderType.REAL;
|
||||
private static final DownloaderType DEFAULT_DOWNLOADER = DownloaderType.REAL;
|
||||
|
||||
public static DownloaderType getDownloaderType() {
|
||||
try {
|
||||
return DownloaderType.valueOf(System.getProperty("downloader"));
|
||||
} catch (final Exception e) {
|
||||
return DEFAULT_DOWNLOADER;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package org.schabi.newpipe.downloader;
|
||||
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Use this to annotate tests methods/classes that should only be run when the downloader is of type
|
||||
* {@link DownloaderType#MOCK} or {@link DownloaderType#RECORDING}. This should be used when e.g. an
|
||||
* extractor returns different results each time because the underlying service web page does so. In
|
||||
* that case it makes sense to only run the tests with the mock downloader, since the real web page
|
||||
* is not reliable, but we still want to make sure that the code correctly interprets the stored and
|
||||
* mocked web page data.
|
||||
* @see MockOnlyCondition
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@ExtendWith(MockOnlyCondition.class)
|
||||
public @interface MockOnly {
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.schabi.newpipe.downloader;
|
||||
|
||||
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
|
||||
import org.junit.jupiter.api.extension.ExecutionCondition;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
|
||||
/**
|
||||
* @see MockOnly
|
||||
*/
|
||||
public class MockOnlyCondition implements ExecutionCondition {
|
||||
private static final String MOCK_ONLY_REASON = "Mock only";
|
||||
|
||||
@Override
|
||||
public ConditionEvaluationResult evaluateExecutionCondition(final ExtensionContext context) {
|
||||
if (DownloaderFactory.getDownloaderType() == DownloaderType.REAL) {
|
||||
return ConditionEvaluationResult.disabled(MOCK_ONLY_REASON);
|
||||
} else {
|
||||
return ConditionEvaluationResult.enabled(MOCK_ONLY_REASON);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -43,7 +43,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
|
||||
|
@ -68,7 +68,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();
|
||||
|
@ -171,7 +171,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();
|
||||
|
@ -290,7 +290,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();
|
||||
|
@ -394,7 +394,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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue