diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java index 297b689e4..afb49967d 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java @@ -6,8 +6,8 @@ import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; -import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler; +import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.extractor.utils.ExtractorHelper; import java.io.IOException; @@ -38,12 +38,23 @@ public class ChannelInfo extends ListInfo { super(serviceId, urlIdHandler, name); } + @Deprecated public static ChannelInfo getInfo(String url) throws IOException, ExtractionException { - return getInfo(NewPipe.getServiceByUrl(url), url); + return getInfo(NewPipe.getServiceByUrl(url), url, null); } + public static ChannelInfo getInfo(String url, String language) throws IOException, ExtractionException { + return getInfo(NewPipe.getServiceByUrl(url), url, language); + } + + @Deprecated public static ChannelInfo getInfo(StreamingService service, String url) throws IOException, ExtractionException { + return getInfo(service, url, null); + } + + public static ChannelInfo getInfo(StreamingService service, String url, String language) throws IOException, ExtractionException { ChannelExtractor extractor = service.getChannelExtractor(url); + extractor.setLanguage(language); extractor.fetchPage(); return getInfo(extractor); } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskInfo.java b/extractor/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskInfo.java index 6c357bd19..498b79f9b 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskInfo.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskInfo.java @@ -35,27 +35,53 @@ public class KioskInfo extends ListInfo { super(serviceId, urlIdHandler, name); } + @Deprecated public static ListExtractor.InfoItemsPage getMoreItems(StreamingService service, String url, String pageUrl, String contentCountry) throws IOException, ExtractionException { + return getMoreItems(service, url, pageUrl, contentCountry, null); + } + + public static ListExtractor.InfoItemsPage getMoreItems(StreamingService service, + String url, + String pageUrl, + String contentCountry, + String language) throws IOException, ExtractionException { KioskList kl = service.getKioskList(); KioskExtractor extractor = kl.getExtractorByUrl(url, pageUrl); extractor.setContentCountry(contentCountry); + extractor.setLanguage(language); return extractor.getPage(pageUrl); } + @Deprecated public static KioskInfo getInfo(String url, String contentCountry) throws IOException, ExtractionException { - return getInfo(NewPipe.getServiceByUrl(url), url, contentCountry); + return getInfo(url, contentCountry, null); + } + + public static KioskInfo getInfo(String url, + String contentCountry, + String language) throws IOException, ExtractionException { + return getInfo(NewPipe.getServiceByUrl(url), url, contentCountry, language); + } + + @Deprecated + public static KioskInfo getInfo(StreamingService service, + String url, + String contentCountry) throws IOException, ExtractionException { + return getInfo(service, url, contentCountry, null); } public static KioskInfo getInfo(StreamingService service, String url, - String contentCountry) throws IOException, ExtractionException { + String contentCountry, + String language) throws IOException, ExtractionException { KioskList kl = service.getKioskList(); KioskExtractor extractor = kl.getExtractorByUrl(url, null); extractor.setContentCountry(contentCountry); + extractor.setLanguage(language); extractor.fetchPage(); return getInfo(extractor); } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingExtractorTest.java index bf1ae8bb7..6e6cc844f 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingExtractorTest.java @@ -49,8 +49,9 @@ public class YoutubeTrendingExtractorTest { extractor = (YoutubeTrendingExtractor) YouTube .getKioskList() .getExtractorById("Trending", null); - extractor.fetchPage(); + extractor.setLanguage("ru"); extractor.setContentCountry("de"); + extractor.fetchPage(); } @Test 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 66369170a..4cde88b4f 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 @@ -45,7 +45,7 @@ public class YoutubeTrendingKioskInfoTest { StreamingService service = YouTube; LinkHandlerFactory LinkHandlerFactory = service.getKioskList().getListLinkHandlerFactoryByType("Trending"); - kioskInfo = KioskInfo.getInfo(YouTube, LinkHandlerFactory.fromId("Trending").getUrl(), null); + kioskInfo = KioskInfo.getInfo(YouTube, LinkHandlerFactory.fromId("Trending").getUrl(), null, null); } @Test