From bc6c643a2a26d190c144ebe011d5854e892483e5 Mon Sep 17 00:00:00 2001 From: CypherpunkSamurai Date: Thu, 16 Feb 2023 19:56:03 +0530 Subject: [PATCH] fix exception --- .../schabi/newpipe/extractor/Extractor.java | 2 +- .../extractor/services/xh/XhService.java | 36 ++++++++++--------- .../xh/extractors/XhSearchExtractor.java | 16 +++++---- .../xh/extractors/XhStreamExtractor.java | 4 +-- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/Extractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/Extractor.java index e973b441..53312175 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/Extractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/Extractor.java @@ -21,7 +21,7 @@ public abstract class Extractor { * cleaning/accepting/get id from urls). */ private final StreamingService service; - private final LinkHandler linkHandler; + public final LinkHandler linkHandler; @Nullable private Localization forcedLocalization = null; diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/xh/XhService.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/xh/XhService.java index d379f412..45facd9f 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/xh/XhService.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/xh/XhService.java @@ -16,6 +16,7 @@ import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandler; import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandlerFactory; import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; import org.schabi.newpipe.extractor.search.SearchExtractor; +import org.schabi.newpipe.extractor.services.xh.extractors.XhSearchExtractor; import org.schabi.newpipe.extractor.services.xh.extractors.XhStreamExtractor; import org.schabi.newpipe.extractor.stream.StreamExtractor; import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor; @@ -39,65 +40,66 @@ public class XhService extends StreamingService { public XhService(int id, String name, List capabilities) { super(id, NAME, Arrays.asList(VIDEO)); } + @Override public String getBaseUrl() { return BASE_URL; } + + @Override + public SearchExtractor getSearchExtractor(SearchQueryHandler query) { + return new XhSearchExtractor(this, query); + } @Override public LinkHandlerFactory getStreamLHFactory() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + return null; } @Override public ListLinkHandlerFactory getChannelLHFactory() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + return null; } @Override public ListLinkHandlerFactory getPlaylistLHFactory() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + return null; } @Override public SearchQueryHandlerFactory getSearchQHFactory() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + return null; } @Override public ListLinkHandlerFactory getCommentsLHFactory() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + return null; } - - @Override - public SearchExtractor getSearchExtractor(SearchQueryHandler queryHandler) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - + @Override public SuggestionExtractor getSuggestionExtractor() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + return null; } @Override public SubscriptionExtractor getSubscriptionExtractor() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + return null; } @Override public KioskList getKioskList() throws ExtractionException { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + return null; } @Override public ChannelExtractor getChannelExtractor(ListLinkHandler linkHandler) throws ExtractionException { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + return null; } @Override public PlaylistExtractor getPlaylistExtractor(ListLinkHandler linkHandler) throws ExtractionException { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + return null; } @Override @@ -107,6 +109,6 @@ public class XhService extends StreamingService { @Override public CommentsExtractor getCommentsExtractor(ListLinkHandler linkHandler) throws ExtractionException { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + return null; } } \ No newline at end of file diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/xh/extractors/XhSearchExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/xh/extractors/XhSearchExtractor.java index 8e9b61bf..2132a386 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/xh/extractors/XhSearchExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/xh/extractors/XhSearchExtractor.java @@ -29,6 +29,7 @@ import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandler; import org.schabi.newpipe.extractor.search.SearchExtractor; +import org.schabi.newpipe.extractor.services.xh.XhService; import static org.schabi.newpipe.extractor.services.xh.XhService.HOST; import org.schabi.newpipe.extractor.services.xh.extractors.items.XhVideo; @@ -37,9 +38,9 @@ import org.schabi.newpipe.extractor.services.xh.extractors.items.XhVideo; * @author Rakesh */ public class XhSearchExtractor extends SearchExtractor { - - public XhSearchExtractor(StreamingService service, SearchQueryHandler linkHandler) { - super(service, linkHandler); + + public XhSearchExtractor(final StreamingService service, final SearchQueryHandler query) { + super(service, query); } @NonNull @@ -60,7 +61,10 @@ public class XhSearchExtractor extends SearchExtractor { @Override public InfoItemsPage getInitialPage() throws IOException, ExtractionException { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + + Page p = new Page(this.linkHandler.getUrl()); + return getPage(p); + } @Override @@ -125,8 +129,6 @@ public class XhSearchExtractor extends SearchExtractor { } @Override - public void onFetchPage(Downloader downloader) throws IOException, ExtractionException { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } + public void onFetchPage(Downloader downloader) throws IOException, ExtractionException {} } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/xh/extractors/XhStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/xh/extractors/XhStreamExtractor.java index be37b8ea..773af4f6 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/xh/extractors/XhStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/xh/extractors/XhStreamExtractor.java @@ -100,7 +100,7 @@ public class XhStreamExtractor extends StreamExtractor { @Override public String getUploaderUrl() throws ParsingException { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + return ""; } @Override @@ -152,7 +152,7 @@ public class XhStreamExtractor extends StreamExtractor { @Override public void onFetchPage(Downloader downloader) throws IOException, ExtractionException { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } @Override