diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java index 40d15288a..5d89350b0 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java @@ -353,6 +353,11 @@ public class YoutubeParsingHelper { return key; } + static void resetClientVersionAndKey() { + clientVersion = null; + key = null; + } + public static boolean areHardcodedYoutubeMusicKeysValid() throws IOException, ReCaptchaException { final String url = "https://music.youtube.com/youtubei/v1/search?alt=json&key=" + HARDCODED_YOUTUBE_MUSIC_KEYS[0]; diff --git a/extractor/src/test/java/org/schabi/newpipe/downloader/MockDownloader.java b/extractor/src/test/java/org/schabi/newpipe/downloader/MockDownloader.java index b15c949c0..1dfa78471 100644 --- a/extractor/src/test/java/org/schabi/newpipe/downloader/MockDownloader.java +++ b/extractor/src/test/java/org/schabi/newpipe/downloader/MockDownloader.java @@ -31,15 +31,6 @@ class MockDownloader extends Downloader { reader.close(); mocks.put(response.getRequest(), response.getResponse()); } - - //shared find proper solution - File clientVersion = new File("src/test/resources/org/schabi/newpipe/extractor/services/youtube/client_version.json"); - final FileReader reader = new FileReader(clientVersion); - final TestRequestResponse response = new GsonBuilder() - .create() - .fromJson(reader, TestRequestResponse.class); - reader.close(); - mocks.put(response.getRequest(), response.getResponse()); } @Override 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 ffda7aac6..689b3329c 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 @@ -53,6 +53,7 @@ public class YoutubeMixPlaylistExtractorTest { @BeforeClass public static void setUp() throws Exception { + YoutubeParsingHelper.resetClientVersionAndKey(); final File file = new File(RESOURCE_PATH + "mix"); NewPipe.init(new DownloaderFactory().getDownloader(file.getAbsolutePath())); extractor = (YoutubeMixPlaylistExtractor) YouTube @@ -131,6 +132,7 @@ public class YoutubeMixPlaylistExtractorTest { @BeforeClass public static void setUp() throws Exception { + YoutubeParsingHelper.resetClientVersionAndKey(); final File file = new File(RESOURCE_PATH + "mixWithIndex"); NewPipe.init(new DownloaderFactory().getDownloader(file.getAbsolutePath())); extractor = (YoutubeMixPlaylistExtractor) YouTube @@ -201,6 +203,7 @@ public class YoutubeMixPlaylistExtractorTest { @BeforeClass public static void setUp() throws Exception { + YoutubeParsingHelper.resetClientVersionAndKey(); final File file = new File(RESOURCE_PATH + "myMix"); NewPipe.init(new DownloaderFactory().getDownloader(file.getAbsolutePath())); extractor = (YoutubeMixPlaylistExtractor) YouTube @@ -274,6 +277,7 @@ public class YoutubeMixPlaylistExtractorTest { @BeforeClass public static void setUp() throws IOException { + YoutubeParsingHelper.resetClientVersionAndKey(); final File file = new File(RESOURCE_PATH + "invalid"); NewPipe.init(new DownloaderFactory().getDownloader(file.getAbsolutePath())); } @@ -306,6 +310,7 @@ public class YoutubeMixPlaylistExtractorTest { @BeforeClass public static void setUp() throws Exception { + YoutubeParsingHelper.resetClientVersionAndKey(); final File file = new File(RESOURCE_PATH + "channelMix"); NewPipe.init(new DownloaderFactory().getDownloader(file.getAbsolutePath())); extractor = (YoutubeMixPlaylistExtractor) YouTube