fix exception

This commit is contained in:
CypherpunkSamurai 2023-02-16 19:56:03 +05:30
parent 9aab6148ba
commit bc6c643a2a
4 changed files with 31 additions and 27 deletions

View File

@ -21,7 +21,7 @@ public abstract class Extractor {
* cleaning/accepting/get id from urls). * cleaning/accepting/get id from urls).
*/ */
private final StreamingService service; private final StreamingService service;
private final LinkHandler linkHandler; public final LinkHandler linkHandler;
@Nullable @Nullable
private Localization forcedLocalization = null; private Localization forcedLocalization = null;

View File

@ -16,6 +16,7 @@ import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandler;
import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandlerFactory; import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandlerFactory;
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
import org.schabi.newpipe.extractor.search.SearchExtractor; 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.services.xh.extractors.XhStreamExtractor;
import org.schabi.newpipe.extractor.stream.StreamExtractor; import org.schabi.newpipe.extractor.stream.StreamExtractor;
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor; import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
@ -39,65 +40,66 @@ public class XhService extends StreamingService {
public XhService(int id, String name, List<ServiceInfo.MediaCapability> capabilities) { public XhService(int id, String name, List<ServiceInfo.MediaCapability> capabilities) {
super(id, NAME, Arrays.asList(VIDEO)); super(id, NAME, Arrays.asList(VIDEO));
} }
@Override @Override
public String getBaseUrl() { public String getBaseUrl() {
return BASE_URL; return BASE_URL;
} }
@Override
public SearchExtractor getSearchExtractor(SearchQueryHandler query) {
return new XhSearchExtractor(this, query);
}
@Override @Override
public LinkHandlerFactory getStreamLHFactory() { public LinkHandlerFactory getStreamLHFactory() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. return null;
} }
@Override @Override
public ListLinkHandlerFactory getChannelLHFactory() { public ListLinkHandlerFactory getChannelLHFactory() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. return null;
} }
@Override @Override
public ListLinkHandlerFactory getPlaylistLHFactory() { public ListLinkHandlerFactory getPlaylistLHFactory() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. return null;
} }
@Override @Override
public SearchQueryHandlerFactory getSearchQHFactory() { public SearchQueryHandlerFactory getSearchQHFactory() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. return null;
} }
@Override @Override
public ListLinkHandlerFactory getCommentsLHFactory() { 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 @Override
public SuggestionExtractor getSuggestionExtractor() { public SuggestionExtractor getSuggestionExtractor() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. return null;
} }
@Override @Override
public SubscriptionExtractor getSubscriptionExtractor() { public SubscriptionExtractor getSubscriptionExtractor() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. return null;
} }
@Override @Override
public KioskList getKioskList() throws ExtractionException { public KioskList getKioskList() throws ExtractionException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. return null;
} }
@Override @Override
public ChannelExtractor getChannelExtractor(ListLinkHandler linkHandler) throws ExtractionException { 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 @Override
public PlaylistExtractor getPlaylistExtractor(ListLinkHandler linkHandler) throws ExtractionException { 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 @Override
@ -107,6 +109,6 @@ public class XhService extends StreamingService {
@Override @Override
public CommentsExtractor getCommentsExtractor(ListLinkHandler linkHandler) throws ExtractionException { public CommentsExtractor getCommentsExtractor(ListLinkHandler linkHandler) throws ExtractionException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. return null;
} }
} }

View File

@ -29,6 +29,7 @@ import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandler; import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandler;
import org.schabi.newpipe.extractor.search.SearchExtractor; 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 static org.schabi.newpipe.extractor.services.xh.XhService.HOST;
import org.schabi.newpipe.extractor.services.xh.extractors.items.XhVideo; 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 * @author Rakesh
*/ */
public class XhSearchExtractor extends SearchExtractor { public class XhSearchExtractor extends SearchExtractor {
public XhSearchExtractor(StreamingService service, SearchQueryHandler linkHandler) { public XhSearchExtractor(final StreamingService service, final SearchQueryHandler query) {
super(service, linkHandler); super(service, query);
} }
@NonNull @NonNull
@ -60,7 +61,10 @@ public class XhSearchExtractor extends SearchExtractor {
@Override @Override
public InfoItemsPage<InfoItem> getInitialPage() throws IOException, ExtractionException { public InfoItemsPage<InfoItem> 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 @Override
@ -125,8 +129,6 @@ public class XhSearchExtractor extends SearchExtractor {
} }
@Override @Override
public void onFetchPage(Downloader downloader) throws IOException, ExtractionException { public void onFetchPage(Downloader downloader) throws IOException, ExtractionException {}
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
} }

View File

@ -100,7 +100,7 @@ public class XhStreamExtractor extends StreamExtractor {
@Override @Override
public String getUploaderUrl() throws ParsingException { public String getUploaderUrl() throws ParsingException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. return "";
} }
@Override @Override
@ -152,7 +152,7 @@ public class XhStreamExtractor extends StreamExtractor {
@Override @Override
public void onFetchPage(Downloader downloader) throws IOException, ExtractionException { public void onFetchPage(Downloader downloader) throws IOException, ExtractionException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} }
@Override @Override