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 1e9b5dac..c3127874 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/Extractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/Extractor.java @@ -14,27 +14,27 @@ public abstract class Extractor { */ private final StreamingService service; - private final UrlIdHandler urlIdHandler; + private final UIHFactory UIHFactory; @Nullable private boolean pageFetched = false; private final Downloader downloader; - public Extractor(final StreamingService service, final UrlIdHandler urlIdHandler) { + public Extractor(final StreamingService service, final UIHFactory UIHFactory) { if(service == null) throw new NullPointerException("service is null"); - if(urlIdHandler == null) throw new NullPointerException("UrlIdHandler is null"); + if(UIHFactory == null) throw new NullPointerException("UIHFactory is null"); this.service = service; - this.urlIdHandler = urlIdHandler; + this.UIHFactory = UIHFactory; this.downloader = NewPipe.getDownloader(); if(downloader == null) throw new NullPointerException("downloader is null"); } /** - * @return The {@link UrlIdHandler} of the current extractor object (e.g. a ChannelExtractor should return a channel url handler). + * @return The {@link UIHFactory} of the current extractor object (e.g. a ChannelExtractor should return a channel url handler). */ @Nonnull - public UrlIdHandler getUrlIdHandler() { - return urlIdHandler; + public UIHFactory getUIHFactory() { + return UIHFactory; } /** @@ -66,7 +66,7 @@ public abstract class Extractor { @Nonnull public String getId() throws ParsingException { - return urlIdHandler.getId(); + return UIHFactory.getId(); } /** @@ -79,12 +79,12 @@ public abstract class Extractor { @Nonnull public String getOriginalUrl() throws ParsingException { - return urlIdHandler.getOriginalUrl(); + return UIHFactory.getOriginalUrl(); } @Nonnull public String getUrl() throws ParsingException { - return urlIdHandler.getUrl(); + return UIHFactory.getUrl(); } @Nonnull diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/Info.java b/extractor/src/main/java/org/schabi/newpipe/extractor/Info.java index 99b4d555..5918a00a 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/Info.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/Info.java @@ -18,7 +18,7 @@ public abstract class Info implements Serializable { /** * Different than the {@link #originalUrl} in the sense that it may be set as a cleaned url. * - * @see UrlIdHandler#getUrl() + * @see UIHFactory#getUrl() * @see Extractor#getOriginalUrl() */ private final String url; @@ -48,11 +48,11 @@ public abstract class Info implements Serializable { this.name = name; } - public Info(int serviceId, UrlIdHandler urlIdHandler, String name) throws ParsingException { + public Info(int serviceId, UIHFactory UIHFactory, String name) throws ParsingException { this(serviceId, - urlIdHandler.getId(), - urlIdHandler.getUrl(), - urlIdHandler.getOriginalUrl(), + UIHFactory.getId(), + UIHFactory.getUrl(), + UIHFactory.getOriginalUrl(), name); } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java index e22ecc04..a07ecdde 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java @@ -12,7 +12,7 @@ import java.util.List; */ public abstract class ListExtractor extends Extractor { - public ListExtractor(StreamingService service, ListUrlIdHandler urlIdHandler) { + public ListExtractor(StreamingService service, ListUIHFactory urlIdHandler) { super(service, urlIdHandler); } @@ -50,8 +50,8 @@ public abstract class ListExtractor extends Extractor { } @Override - public ListUrlIdHandler getUrlIdHandler() { - return (ListUrlIdHandler) super.getUrlIdHandler(); + public ListUIHFactory getUIHFactory() { + return (ListUIHFactory) super.getUIHFactory(); } /*////////////////////////////////////////////////////////////////////////// diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/ListInfo.java b/extractor/src/main/java/org/schabi/newpipe/extractor/ListInfo.java index 7a1b9fac..5d591a1e 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/ListInfo.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/ListInfo.java @@ -1,6 +1,5 @@ package org.schabi.newpipe.extractor; -import com.sun.org.apache.xerces.internal.xs.StringList; import org.schabi.newpipe.extractor.exceptions.ParsingException; import java.util.ArrayList; @@ -24,7 +23,7 @@ public abstract class ListInfo extends Info { this.sortFilter = sortFilter; } - public ListInfo(int serviceId, ListUrlIdHandler listUrlIdHandler, String name) throws ParsingException { + public ListInfo(int serviceId, ListUIHFactory listUrlIdHandler, String name) throws ParsingException { super(serviceId, listUrlIdHandler, name); this.contentFilter = listUrlIdHandler.getContentFilter(); this.sortFilter = listUrlIdHandler.getSortFilter(); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/ListUrlIdHandler.java b/extractor/src/main/java/org/schabi/newpipe/extractor/ListUIHFactory.java similarity index 68% rename from extractor/src/main/java/org/schabi/newpipe/extractor/ListUrlIdHandler.java rename to extractor/src/main/java/org/schabi/newpipe/extractor/ListUIHFactory.java index 8357184a..88ec0e47 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/ListUrlIdHandler.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/ListUIHFactory.java @@ -5,14 +5,14 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException; import java.util.ArrayList; import java.util.List; -public abstract class ListUrlIdHandler extends UrlIdHandler { +public abstract class ListUIHFactory extends UIHFactory { protected List contentFilter = new ArrayList<>(0); protected String sortFilter = ""; - public ListUrlIdHandler setQuery(String id, - List contentFilter, - String sortFilter) throws ParsingException { + public ListUIHFactory setQuery(String id, + List contentFilter, + String sortFilter) throws ParsingException { setId(id); this.contentFilter = contentFilter; this.sortFilter = sortFilter; @@ -20,17 +20,17 @@ public abstract class ListUrlIdHandler extends UrlIdHandler { } - public ListUrlIdHandler setQuery(String id) throws ParsingException { + public ListUIHFactory setQuery(String id) throws ParsingException { setQuery(id, new ArrayList(), ""); return this; } - public ListUrlIdHandler setUrl(String url) throws ParsingException { - return (ListUrlIdHandler) super.setUrl(url); + public ListUIHFactory setUrl(String url) throws ParsingException { + return (ListUIHFactory) super.setUrl(url); } - public ListUrlIdHandler setId(String id) throws ParsingException { - return (ListUrlIdHandler) super.setId(id); + public ListUIHFactory setId(String id) throws ParsingException { + return (ListUIHFactory) super.setId(id); } /** diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/StreamingService.java b/extractor/src/main/java/org/schabi/newpipe/extractor/StreamingService.java index d642a749..04b5ca85 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/StreamingService.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/StreamingService.java @@ -1,14 +1,12 @@ package org.schabi.newpipe.extractor; -import com.sun.org.apache.xerces.internal.xs.StringList; import org.schabi.newpipe.extractor.channel.ChannelExtractor; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.kiosk.KioskList; import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; -import org.schabi.newpipe.extractor.search.SearchEngine; import org.schabi.newpipe.extractor.search.SearchExtractor; -import org.schabi.newpipe.extractor.search.SearchQueryUrlHandler; +import org.schabi.newpipe.extractor.search.SearchQIHFactory; import org.schabi.newpipe.extractor.stream.StreamExtractor; import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor; @@ -69,51 +67,50 @@ public abstract class StreamingService { //////////////////////////////////////////// // Url Id handler //////////////////////////////////////////// - public abstract UrlIdHandler getStreamUrlIdHandler(); - public abstract ListUrlIdHandler getChannelUrlIdHandler(); - public abstract ListUrlIdHandler getPlaylistUrlIdHandler(); - public abstract SearchQueryUrlHandler getSearchQueryHandler(); + public abstract UIHFactory getStreamUIHFactory(); + public abstract ListUIHFactory getChannelUIHFactory(); + public abstract ListUIHFactory getPlaylistUIHFactory(); + public abstract SearchQIHFactory getSearchQIHFactory(); //////////////////////////////////////////// // Extractor //////////////////////////////////////////// - public abstract SearchEngine getSearchEngine(); - public abstract SearchExtractor getSearchExtractor(SearchQueryUrlHandler queryHandler, String contentCountry); + public abstract SearchExtractor getSearchExtractor(SearchQIHFactory queryHandler, String contentCountry); public abstract SuggestionExtractor getSuggestionExtractor(); public abstract SubscriptionExtractor getSubscriptionExtractor(); public abstract KioskList getKioskList() throws ExtractionException; - public abstract ChannelExtractor getChannelExtractor(ListUrlIdHandler urlIdHandler) throws ExtractionException; - public abstract PlaylistExtractor getPlaylistExtractor(ListUrlIdHandler urlIdHandler) throws ExtractionException; - public abstract StreamExtractor getStreamExtractor(UrlIdHandler urlIdHandler) throws ExtractionException; + public abstract ChannelExtractor getChannelExtractor(ListUIHFactory urlIdHandler) throws ExtractionException; + public abstract PlaylistExtractor getPlaylistExtractor(ListUIHFactory urlIdHandler) throws ExtractionException; + public abstract StreamExtractor getStreamExtractor(UIHFactory UIHFactory) throws ExtractionException; public SearchExtractor getSearchExtractor(String query, List contentFilter, String sortFilter, String contentCountry) throws ExtractionException { - return getSearchExtractor(getSearchQueryHandler().setQuery(query, contentFilter, sortFilter), contentCountry); + return getSearchExtractor(getSearchQIHFactory().setQuery(query, contentFilter, sortFilter), contentCountry); } public ChannelExtractor getChannelExtractor(String id, List contentFilter, String sortFilter) throws ExtractionException { - return getChannelExtractor(getChannelUrlIdHandler().setQuery(id, contentFilter, sortFilter)); + return getChannelExtractor(getChannelUIHFactory().setQuery(id, contentFilter, sortFilter)); } public PlaylistExtractor getPlaylistExtractor(String id, List contentFilter, String sortFilter) throws ExtractionException { - return getPlaylistExtractor(getPlaylistUrlIdHandler().setQuery(id, contentFilter, sortFilter)); + return getPlaylistExtractor(getPlaylistUIHFactory().setQuery(id, contentFilter, sortFilter)); } public SearchExtractor getSearchExtractor(String query, String contentCountry) throws ExtractionException { - return getSearchExtractor(getSearchQueryHandler().setQuery(query), contentCountry); + return getSearchExtractor(getSearchQIHFactory().setQuery(query), contentCountry); } public ChannelExtractor getChannelExtractor(String url) throws ExtractionException { - return getChannelExtractor(getChannelUrlIdHandler().setUrl(url)); + return getChannelExtractor(getChannelUIHFactory().setUrl(url)); } public PlaylistExtractor getPlaylistExtractor(String url) throws ExtractionException { - return getPlaylistExtractor(getPlaylistUrlIdHandler().setUrl(url)); + return getPlaylistExtractor(getPlaylistUIHFactory().setUrl(url)); } public StreamExtractor getStreamExtractor(String url) throws ExtractionException { - return getStreamExtractor(getStreamUrlIdHandler().setUrl(url)); + return getStreamExtractor(getStreamUIHFactory().setUrl(url)); } @@ -122,9 +119,9 @@ public abstract class StreamingService { * figure out where the link is pointing to (a channel, video, playlist, etc.) */ public final LinkType getLinkTypeByUrl(String url) throws ParsingException { - UrlIdHandler sH = getStreamUrlIdHandler(); - UrlIdHandler cH = getChannelUrlIdHandler(); - UrlIdHandler pH = getPlaylistUrlIdHandler(); + UIHFactory sH = getStreamUIHFactory(); + UIHFactory cH = getChannelUIHFactory(); + UIHFactory pH = getPlaylistUIHFactory(); if (sH.acceptUrl(url)) { return LinkType.STREAM; diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/UrlIdHandler.java b/extractor/src/main/java/org/schabi/newpipe/extractor/UIHFactory.java similarity index 89% rename from extractor/src/main/java/org/schabi/newpipe/extractor/UrlIdHandler.java rename to extractor/src/main/java/org/schabi/newpipe/extractor/UIHFactory.java index a9fda4d3..fbf4e7ef 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/UrlIdHandler.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/UIHFactory.java @@ -1,13 +1,12 @@ package org.schabi.newpipe.extractor; -import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; /* * Created by Christian Schabesberger on 26.07.16. * * Copyright (C) Christian Schabesberger 2016 - * UrlIdHandler.java is part of NewPipe. + * UIHFactory.java is part of NewPipe. * * NewPipe is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +22,7 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException; * along with NewPipe. If not, see . */ -public abstract class UrlIdHandler { +public abstract class UIHFactory { protected String id = ""; protected String originalUrl = ""; @@ -33,14 +32,14 @@ public abstract class UrlIdHandler { public abstract boolean onAcceptUrl(final String url) throws ParsingException; - public UrlIdHandler setUrl(String url) throws ParsingException { + public UIHFactory setUrl(String url) throws ParsingException { if(url == null) throw new IllegalArgumentException("url can not be null"); originalUrl = url; id = onGetIdFromUrl(url); return this; } - public UrlIdHandler setId(String id) throws ParsingException { + public UIHFactory setId(String id) throws ParsingException { if(id == null) throw new IllegalArgumentException("id can not be null"); this.id = id; if(!acceptUrl(getUrl())) { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java index 9d6bef52..b41f041e 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java @@ -1,15 +1,11 @@ package org.schabi.newpipe.extractor.channel; import org.schabi.newpipe.extractor.ListExtractor; -import org.schabi.newpipe.extractor.ListUrlIdHandler; +import org.schabi.newpipe.extractor.ListUIHFactory; import org.schabi.newpipe.extractor.StreamingService; -import org.schabi.newpipe.extractor.UrlIdHandler; -import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.stream.StreamInfoItem; -import javax.annotation.Nonnull; - /* * Created by Christian Schabesberger on 25.07.16. * @@ -32,7 +28,7 @@ import javax.annotation.Nonnull; public abstract class ChannelExtractor extends ListExtractor { - public ChannelExtractor(StreamingService service, ListUrlIdHandler urlIdHandler) { + public ChannelExtractor(StreamingService service, ListUIHFactory urlIdHandler) { super(service, urlIdHandler); } 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 38f2b6e4..372feaa9 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 @@ -2,7 +2,7 @@ package org.schabi.newpipe.extractor.channel; import org.schabi.newpipe.extractor.ListExtractor.InfoItemsPage; import org.schabi.newpipe.extractor.ListInfo; -import org.schabi.newpipe.extractor.ListUrlIdHandler; +import org.schabi.newpipe.extractor.ListUIHFactory; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.exceptions.ExtractionException; @@ -34,7 +34,7 @@ import java.io.IOException; public class ChannelInfo extends ListInfo { - public ChannelInfo(int serviceId, ListUrlIdHandler urlIdHandler, String name) throws ParsingException { + public ChannelInfo(int serviceId, ListUIHFactory urlIdHandler, String name) throws ParsingException { super(serviceId, urlIdHandler, name); } @@ -55,7 +55,7 @@ public class ChannelInfo extends ListInfo { public static ChannelInfo getInfo(ChannelExtractor extractor) throws IOException, ExtractionException { ChannelInfo info = new ChannelInfo(extractor.getServiceId(), - extractor.getUrlIdHandler(), + extractor.getUIHFactory(), extractor.getName()); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskExtractor.java index 95ce34f5..c46de368 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskExtractor.java @@ -21,9 +21,8 @@ package org.schabi.newpipe.extractor.kiosk; */ import org.schabi.newpipe.extractor.ListExtractor; -import org.schabi.newpipe.extractor.ListUrlIdHandler; +import org.schabi.newpipe.extractor.ListUIHFactory; 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; @@ -34,7 +33,7 @@ public abstract class KioskExtractor extends ListExtractor { private final String id; public KioskExtractor(StreamingService streamingService, - ListUrlIdHandler urlIdHandler, + ListUIHFactory urlIdHandler, String kioskId) { super(streamingService, urlIdHandler); this.id = kioskId; 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 56feb40e..afd02727 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 @@ -30,7 +30,7 @@ import java.io.IOException; public class KioskInfo extends ListInfo { - private KioskInfo(int serviceId, ListUrlIdHandler urlIdHandler, String name) throws ParsingException { + private KioskInfo(int serviceId, ListUIHFactory urlIdHandler, String name) throws ParsingException { super(serviceId, urlIdHandler, name); } @@ -67,7 +67,7 @@ public class KioskInfo extends ListInfo { public static KioskInfo getInfo(KioskExtractor extractor) throws ExtractionException { final KioskInfo info = new KioskInfo(extractor.getServiceId(), - extractor.getUrlIdHandler(), + extractor.getUIHFactory(), extractor.getName()); final ListExtractor.InfoItemsPage itemsPage = ExtractorHelper.getItemsPageOrLogError(info, extractor); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskList.java b/extractor/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskList.java index 11c8f141..a4739e63 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskList.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskList.java @@ -2,7 +2,7 @@ package org.schabi.newpipe.extractor.kiosk; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.StreamingService; -import org.schabi.newpipe.extractor.UrlIdHandler; +import org.schabi.newpipe.extractor.UIHFactory; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import java.io.IOException; @@ -23,19 +23,19 @@ public class KioskList { private String defaultKiosk = null; private class KioskEntry { - public KioskEntry(KioskExtractorFactory ef, UrlIdHandler h) { + public KioskEntry(KioskExtractorFactory ef, UIHFactory h) { extractorFactory = ef; handler = h; } final KioskExtractorFactory extractorFactory; - final UrlIdHandler handler; + final UIHFactory handler; } public KioskList(int service_id) { this.service_id = service_id; } - public void addKioskEntry(KioskExtractorFactory extractorFactory, UrlIdHandler handler, String id) + public void addKioskEntry(KioskExtractorFactory extractorFactory, UIHFactory handler, String id) throws Exception { if(kioskList.get(id) != null) { throw new Exception("Kiosk with type " + id + " already exists."); @@ -92,7 +92,7 @@ public class KioskList { throw new ExtractionException("Could not find a kiosk that fits to the url: " + url); } - public UrlIdHandler getUrlIdHandlerByType(String type) { + public UIHFactory getUrlIdHandlerByType(String type) { return kioskList.get(type).handler; } } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistExtractor.java index 490367fe..924ff8cb 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistExtractor.java @@ -1,18 +1,14 @@ package org.schabi.newpipe.extractor.playlist; import org.schabi.newpipe.extractor.ListExtractor; -import org.schabi.newpipe.extractor.ListUrlIdHandler; +import org.schabi.newpipe.extractor.ListUIHFactory; import org.schabi.newpipe.extractor.StreamingService; -import org.schabi.newpipe.extractor.UrlIdHandler; -import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.stream.StreamInfoItem; -import javax.annotation.Nonnull; - public abstract class PlaylistExtractor extends ListExtractor { - public PlaylistExtractor(StreamingService service, ListUrlIdHandler urlIdHandler) { + public PlaylistExtractor(StreamingService service, ListUIHFactory urlIdHandler) { super(service, urlIdHandler); } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java b/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java index cdc6c5fe..edcfe34e 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java @@ -2,7 +2,7 @@ package org.schabi.newpipe.extractor.playlist; import org.schabi.newpipe.extractor.ListExtractor.InfoItemsPage; import org.schabi.newpipe.extractor.ListInfo; -import org.schabi.newpipe.extractor.ListUrlIdHandler; +import org.schabi.newpipe.extractor.ListUIHFactory; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.exceptions.ExtractionException; @@ -14,7 +14,7 @@ import java.io.IOException; public class PlaylistInfo extends ListInfo { - public PlaylistInfo(int serviceId, ListUrlIdHandler urlIdHandler, String name) throws ParsingException { + public PlaylistInfo(int serviceId, ListUIHFactory urlIdHandler, String name) throws ParsingException { super(serviceId, urlIdHandler, name); } @@ -41,7 +41,7 @@ public class PlaylistInfo extends ListInfo { final PlaylistInfo info = new PlaylistInfo( extractor.getServiceId(), - extractor.getUrlIdHandler(), + extractor.getUIHFactory(), extractor.getName()); try { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchExtractor.java index ecbe5fca..68a10ded 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchExtractor.java @@ -17,14 +17,14 @@ public abstract class SearchExtractor extends ListExtractor { private final InfoItemsSearchCollector collector; private final String contentCountry; - public SearchExtractor(StreamingService service, SearchQueryUrlHandler urlIdHandler, String contentCountry) { + public SearchExtractor(StreamingService service, SearchQIHFactory urlIdHandler, String contentCountry) { super(service, urlIdHandler); collector = new InfoItemsSearchCollector(service.getServiceId()); this.contentCountry = contentCountry; } public String getSearchString() { - return getUrlIdHandler().getSearchString(); + return getUIHFactory().getSearchString(); } public abstract String getSearchSuggestion() throws ParsingException; @@ -34,13 +34,13 @@ public abstract class SearchExtractor extends ListExtractor { } @Override - public SearchQueryUrlHandler getUrlIdHandler() { - return (SearchQueryUrlHandler) super.getUrlIdHandler(); + public SearchQIHFactory getUIHFactory() { + return (SearchQIHFactory) super.getUIHFactory(); } @Override public String getName() { - return getUrlIdHandler().getSearchString(); + return getUIHFactory().getSearchString(); } protected String getContentCountry() { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchInfo.java b/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchInfo.java index 6b7c8b8b..4d9ad12d 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchInfo.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchInfo.java @@ -2,7 +2,7 @@ package org.schabi.newpipe.extractor.search; import org.schabi.newpipe.extractor.InfoItem; import org.schabi.newpipe.extractor.ListInfo; -import org.schabi.newpipe.extractor.ListUrlIdHandler; +import org.schabi.newpipe.extractor.ListUIHFactory; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; @@ -13,7 +13,7 @@ public class SearchInfo extends ListInfo { public SearchInfo(int serviceId, - ListUrlIdHandler urlIdHandler, + ListUIHFactory urlIdHandler, String searchString) throws ParsingException { super(serviceId, urlIdHandler, "Search"); this.searchString = searchString; @@ -23,7 +23,7 @@ public class SearchInfo extends ListInfo { public static SearchInfo getInfo(SearchExtractor extractor) throws ExtractionException { final SearchInfo info = new SearchInfo( extractor.getServiceId(), - extractor.getUrlIdHandler(), + extractor.getUIHFactory(), extractor.getSearchString()); try { diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchQIHFactory.java b/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchQIHFactory.java new file mode 100644 index 00000000..2e96f434 --- /dev/null +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchQIHFactory.java @@ -0,0 +1,44 @@ +package org.schabi.newpipe.extractor.search; + +import org.schabi.newpipe.extractor.ListUIHFactory; +import org.schabi.newpipe.extractor.exceptions.ParsingException; + +import java.util.List; + +public abstract class SearchQIHFactory extends ListUIHFactory { + + @Override + public String onGetIdFromUrl(String url) { + return "Search"; + } + + public String getSearchString() { + return getId(); + } + + @Override + public SearchQIHFactory setQuery(String querry, + List contentFilter, + String sortFilter) throws ParsingException { + return (SearchQIHFactory) super.setQuery(querry, contentFilter, sortFilter); + } + + + @Override + public SearchQIHFactory setQuery(String querry) throws ParsingException { + return (SearchQIHFactory) super.setQuery(querry); + } + + + @Override + public boolean onAcceptUrl(String url) { + return false; + } + + public SearchQIHFactory setId(String query) throws ParsingException { + if(query == null) throw new IllegalArgumentException("id can not be null"); + this.id = query; + return this; + } + +} diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchQueryUrlHandler.java b/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchQueryUrlHandler.java deleted file mode 100644 index d72dbb0a..00000000 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/search/SearchQueryUrlHandler.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.schabi.newpipe.extractor.search; - -import org.schabi.newpipe.extractor.ListUrlIdHandler; -import org.schabi.newpipe.extractor.exceptions.ParsingException; - -import java.util.List; - -public abstract class SearchQueryUrlHandler extends ListUrlIdHandler { - - @Override - public String onGetIdFromUrl(String url) { - return "Search"; - } - - public String getSearchString() { - return getId(); - } - - @Override - public SearchQueryUrlHandler setQuery(String querry, - List contentFilter, - String sortFilter) throws ParsingException { - return (SearchQueryUrlHandler) super.setQuery(querry, contentFilter, sortFilter); - } - - - @Override - public SearchQueryUrlHandler setQuery(String querry) throws ParsingException { - return (SearchQueryUrlHandler) super.setQuery(querry); - } - - - @Override - public boolean onAcceptUrl(String url) { - return false; - } - - public SearchQueryUrlHandler setId(String query) throws ParsingException { - if(query == null) throw new IllegalArgumentException("id can not be null"); - this.id = query; - return this; - } - -} diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractor.java index 6c2aba0d..9eaeef46 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractor.java @@ -5,7 +5,7 @@ import com.grack.nanojson.JsonObject; import com.grack.nanojson.JsonParser; import com.grack.nanojson.JsonParserException; import org.schabi.newpipe.extractor.Downloader; -import org.schabi.newpipe.extractor.ListUrlIdHandler; +import org.schabi.newpipe.extractor.ListUIHFactory; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.channel.ChannelExtractor; import org.schabi.newpipe.extractor.exceptions.ExtractionException; @@ -16,8 +16,6 @@ import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector; import javax.annotation.Nonnull; import java.io.IOException; -import static org.schabi.newpipe.extractor.utils.Utils.replaceHttpWithHttps; - @SuppressWarnings("WeakerAccess") public class SoundcloudChannelExtractor extends ChannelExtractor { private String userId; @@ -26,14 +24,14 @@ public class SoundcloudChannelExtractor extends ChannelExtractor { private StreamInfoItemsCollector streamInfoItemsCollector = null; private String nextPageUrl = null; - public SoundcloudChannelExtractor(StreamingService service, ListUrlIdHandler urlIdHandler) { + public SoundcloudChannelExtractor(StreamingService service, ListUIHFactory urlIdHandler) { super(service, urlIdHandler); } @Override public void onFetchPage(@Nonnull Downloader downloader) throws IOException, ExtractionException { - userId = getUrlIdHandler().getId(); + userId = getUIHFactory().getId(); String apiUrl = "https://api-v2.soundcloud.com/users/" + userId + "?client_id=" + SoundcloudParsingHelper.clientId(); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelUrlIdHandler.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelUIHFactory.java similarity index 69% rename from extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelUrlIdHandler.java rename to extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelUIHFactory.java index 063ad7aa..142d8da3 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelUrlIdHandler.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelUIHFactory.java @@ -1,22 +1,16 @@ package org.schabi.newpipe.extractor.services.soundcloud; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Element; -import org.schabi.newpipe.extractor.ListUrlIdHandler; -import org.schabi.newpipe.extractor.NewPipe; -import org.schabi.newpipe.extractor.UrlIdHandler; +import org.schabi.newpipe.extractor.ListUIHFactory; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.utils.Parser; import org.schabi.newpipe.extractor.utils.Utils; -import static org.schabi.newpipe.extractor.utils.Utils.replaceHttpWithHttps; - -public class SoundcloudChannelUrlIdHandler extends ListUrlIdHandler { - private static final SoundcloudChannelUrlIdHandler instance = new SoundcloudChannelUrlIdHandler(); +public class SoundcloudChannelUIHFactory extends ListUIHFactory { + private static final SoundcloudChannelUIHFactory instance = new SoundcloudChannelUIHFactory(); private final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+" + "(/((tracks|albums|sets|reposts|followers|following)/?)?)?([#?].*)?$"; - public static SoundcloudChannelUrlIdHandler getInstance() { + public static SoundcloudChannelUIHFactory getInstance() { return instance; } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractor.java index d2423fcb..24542dce 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractor.java @@ -1,9 +1,8 @@ package org.schabi.newpipe.extractor.services.soundcloud; import org.schabi.newpipe.extractor.Downloader; -import org.schabi.newpipe.extractor.ListUrlIdHandler; +import org.schabi.newpipe.extractor.ListUIHFactory; import org.schabi.newpipe.extractor.StreamingService; -import org.schabi.newpipe.extractor.UrlIdHandler; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.kiosk.KioskExtractor; import org.schabi.newpipe.extractor.stream.StreamInfoItem; @@ -18,7 +17,7 @@ public class SoundcloudChartsExtractor extends KioskExtractor { private StreamInfoItemsCollector collector = null; private String nextPageUrl = null; - public SoundcloudChartsExtractor(StreamingService service, ListUrlIdHandler urlIdHandler, String kioskId) { + public SoundcloudChartsExtractor(StreamingService service, ListUIHFactory urlIdHandler, String kioskId) { super(service, urlIdHandler, kioskId); } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUrlIdHandler.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUIHFactory.java similarity index 79% rename from extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUrlIdHandler.java rename to extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUIHFactory.java index 03a846cb..f4b9109e 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUrlIdHandler.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUIHFactory.java @@ -1,11 +1,9 @@ package org.schabi.newpipe.extractor.services.soundcloud; -import org.schabi.newpipe.extractor.ListUrlIdHandler; -import org.schabi.newpipe.extractor.UrlIdHandler; -import org.schabi.newpipe.extractor.exceptions.ParsingException; +import org.schabi.newpipe.extractor.ListUIHFactory; import org.schabi.newpipe.extractor.utils.Parser; -public class SoundcloudChartsUrlIdHandler extends ListUrlIdHandler { +public class SoundcloudChartsUIHFactory extends ListUIHFactory { private final String TOP_URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/charts(/top)?/?([#?].*)?$"; private final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/charts(/top|/new)?/?([#?].*)?$"; diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractor.java index d6647539..00c61949 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractor.java @@ -4,7 +4,7 @@ import com.grack.nanojson.JsonObject; import com.grack.nanojson.JsonParser; import com.grack.nanojson.JsonParserException; import org.schabi.newpipe.extractor.Downloader; -import org.schabi.newpipe.extractor.ListUrlIdHandler; +import org.schabi.newpipe.extractor.ListUIHFactory; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; @@ -15,8 +15,6 @@ import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector; import javax.annotation.Nonnull; import java.io.IOException; -import static org.schabi.newpipe.extractor.utils.Utils.replaceHttpWithHttps; - @SuppressWarnings("WeakerAccess") public class SoundcloudPlaylistExtractor extends PlaylistExtractor { private String playlistId; @@ -25,14 +23,14 @@ public class SoundcloudPlaylistExtractor extends PlaylistExtractor { private StreamInfoItemsCollector streamInfoItemsCollector = null; private String nextPageUrl = null; - public SoundcloudPlaylistExtractor(StreamingService service, ListUrlIdHandler urlIdHandler) { + public SoundcloudPlaylistExtractor(StreamingService service, ListUIHFactory urlIdHandler) { super(service, urlIdHandler); } @Override public void onFetchPage(@Nonnull Downloader downloader) throws IOException, ExtractionException { - playlistId = getUrlIdHandler().getId(); + playlistId = getUIHFactory().getId(); String apiUrl = "https://api.soundcloud.com/playlists/" + playlistId + "?client_id=" + SoundcloudParsingHelper.clientId() + "&representation=compact"; diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistUrlIdHandler.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistUIHFactory.java similarity index 80% rename from extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistUrlIdHandler.java rename to extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistUIHFactory.java index 2855c1d5..18bd4f61 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistUrlIdHandler.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistUIHFactory.java @@ -1,16 +1,16 @@ package org.schabi.newpipe.extractor.services.soundcloud; -import org.schabi.newpipe.extractor.ListUrlIdHandler; +import org.schabi.newpipe.extractor.ListUIHFactory; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.utils.Parser; import org.schabi.newpipe.extractor.utils.Utils; -public class SoundcloudPlaylistUrlIdHandler extends ListUrlIdHandler { - private static final SoundcloudPlaylistUrlIdHandler instance = new SoundcloudPlaylistUrlIdHandler(); +public class SoundcloudPlaylistUIHFactory extends ListUIHFactory { + private static final SoundcloudPlaylistUIHFactory instance = new SoundcloudPlaylistUIHFactory(); private final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+" + "/sets/[0-9a-z_-]+/?([#?].*)?$"; - public static SoundcloudPlaylistUrlIdHandler getInstance() { + public static SoundcloudPlaylistUIHFactory getInstance() { return instance; } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchExtractor.java index 50452bc2..0ef3c86a 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchExtractor.java @@ -10,7 +10,7 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.search.InfoItemsSearchCollector; import org.schabi.newpipe.extractor.search.SearchEngine; import org.schabi.newpipe.extractor.search.SearchExtractor; -import org.schabi.newpipe.extractor.search.SearchQueryUrlHandler; +import org.schabi.newpipe.extractor.search.SearchQIHFactory; import org.schabi.newpipe.extractor.utils.Parser; import javax.annotation.Nonnull; @@ -19,14 +19,14 @@ import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; -import static org.schabi.newpipe.extractor.services.soundcloud.SoundcloudSearchQueryUrlHandler.ITEMS_PER_PAGE; +import static org.schabi.newpipe.extractor.services.soundcloud.SoundcloudSearchQIHFactory.ITEMS_PER_PAGE; public class SoundcloudSearchExtractor extends SearchExtractor { private JsonArray searchCollection; public SoundcloudSearchExtractor(StreamingService service, - SearchQueryUrlHandler urlIdHandler, + SearchQIHFactory urlIdHandler, String contentCountry) { super(service, urlIdHandler, contentCountry); } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchQueryUrlHandler.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchQIHFactory.java similarity index 93% rename from extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchQueryUrlHandler.java rename to extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchQIHFactory.java index 92d4c6bc..349fd8bf 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchQueryUrlHandler.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchQIHFactory.java @@ -2,13 +2,13 @@ package org.schabi.newpipe.extractor.services.soundcloud; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ReCaptchaException; -import org.schabi.newpipe.extractor.search.SearchQueryUrlHandler; +import org.schabi.newpipe.extractor.search.SearchQIHFactory; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -public class SoundcloudSearchQueryUrlHandler extends SearchQueryUrlHandler { +public class SoundcloudSearchQIHFactory extends SearchQIHFactory { public static final String CHARSET_UTF_8 = "UTF-8"; public static final String TRACKS = "tracks"; diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudService.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudService.java index 73334a34..b55c215e 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudService.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudService.java @@ -1,9 +1,8 @@ package org.schabi.newpipe.extractor.services.soundcloud; -import org.schabi.newpipe.extractor.ListUrlIdHandler; -import org.schabi.newpipe.extractor.StreamingService; -import org.schabi.newpipe.extractor.SuggestionExtractor; -import org.schabi.newpipe.extractor.UrlIdHandler; +import org.schabi.newpipe.extractor.*; +import org.schabi.newpipe.extractor.ListUIHFactory; +import org.schabi.newpipe.extractor.UIHFactory; import org.schabi.newpipe.extractor.channel.ChannelExtractor; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.kiosk.KioskExtractor; @@ -11,7 +10,7 @@ import org.schabi.newpipe.extractor.kiosk.KioskList; import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; import org.schabi.newpipe.extractor.search.SearchEngine; import org.schabi.newpipe.extractor.search.SearchExtractor; -import org.schabi.newpipe.extractor.search.SearchQueryUrlHandler; +import org.schabi.newpipe.extractor.search.SearchQIHFactory; import org.schabi.newpipe.extractor.stream.StreamExtractor; import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor; @@ -25,48 +24,43 @@ public class SoundcloudService extends StreamingService { } @Override - public SearchEngine getSearchEngine() { - return new SoundcloudSearchEngine(getServiceId()); - } - - @Override - public SearchExtractor getSearchExtractor(SearchQueryUrlHandler queryHandler, String contentCountry) { + public SearchExtractor getSearchExtractor(SearchQIHFactory queryHandler, String contentCountry) { return new SoundcloudSearchExtractor(this, queryHandler, contentCountry); } @Override - public SearchQueryUrlHandler getSearchQueryHandler() { - return new SoundcloudSearchQueryUrlHandler(); + public SearchQIHFactory getSearchQIHFactory() { + return new SoundcloudSearchQIHFactory(); } @Override - public UrlIdHandler getStreamUrlIdHandler() { - return SoundcloudStreamUrlIdHandler.getInstance(); + public UIHFactory getStreamUIHFactory() { + return SoundcloudStreamUIHFactory.getInstance(); } @Override - public ListUrlIdHandler getChannelUrlIdHandler() { - return SoundcloudChannelUrlIdHandler.getInstance(); + public ListUIHFactory getChannelUIHFactory() { + return SoundcloudChannelUIHFactory.getInstance(); } @Override - public ListUrlIdHandler getPlaylistUrlIdHandler() { - return SoundcloudPlaylistUrlIdHandler.getInstance(); + public ListUIHFactory getPlaylistUIHFactory() { + return SoundcloudPlaylistUIHFactory.getInstance(); } @Override - public StreamExtractor getStreamExtractor(UrlIdHandler urlIdHandler) { - return new SoundcloudStreamExtractor(this, urlIdHandler); + public StreamExtractor getStreamExtractor(UIHFactory UIHFactory) { + return new SoundcloudStreamExtractor(this, UIHFactory); } @Override - public ChannelExtractor getChannelExtractor(ListUrlIdHandler urlIdHandler) { + public ChannelExtractor getChannelExtractor(ListUIHFactory urlIdHandler) { return new SoundcloudChannelExtractor(this, urlIdHandler); } @Override - public PlaylistExtractor getPlaylistExtractor(ListUrlIdHandler urlIdHandler) { + public PlaylistExtractor getPlaylistExtractor(ListUIHFactory urlIdHandler) { return new SoundcloudPlaylistExtractor(this, urlIdHandler); } @@ -84,14 +78,14 @@ public class SoundcloudService extends StreamingService { String id) throws ExtractionException { return new SoundcloudChartsExtractor(SoundcloudService.this, - new SoundcloudChartsUrlIdHandler().setUrl(url), id); + new SoundcloudChartsUIHFactory().setUrl(url), id); } }; KioskList list = new KioskList(getServiceId()); // add kiosks here e.g.: - final SoundcloudChartsUrlIdHandler h = new SoundcloudChartsUrlIdHandler(); + final SoundcloudChartsUIHFactory h = new SoundcloudChartsUIHFactory(); try { list.addKioskEntry(chartsFactory, h, "Top 50"); list.addKioskEntry(chartsFactory, h, "New & hot"); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java index 46fb76fb..285743fe 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java @@ -17,13 +17,11 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import static org.schabi.newpipe.extractor.utils.Utils.replaceHttpWithHttps; - public class SoundcloudStreamExtractor extends StreamExtractor { private JsonObject track; - public SoundcloudStreamExtractor(StreamingService service, UrlIdHandler urlIdHandler) { - super(service, urlIdHandler); + public SoundcloudStreamExtractor(StreamingService service, UIHFactory UIHFactory) { + super(service, UIHFactory); } @Override diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUrlIdHandler.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUIHFactory.java similarity index 71% rename from extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUrlIdHandler.java rename to extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUIHFactory.java index 7a760a2b..3aec24ec 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUrlIdHandler.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUIHFactory.java @@ -1,24 +1,19 @@ package org.schabi.newpipe.extractor.services.soundcloud; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Element; -import org.schabi.newpipe.extractor.NewPipe; -import org.schabi.newpipe.extractor.UrlIdHandler; +import org.schabi.newpipe.extractor.UIHFactory; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.utils.Parser; import org.schabi.newpipe.extractor.utils.Utils; -import static org.schabi.newpipe.extractor.utils.Utils.replaceHttpWithHttps; - -public class SoundcloudStreamUrlIdHandler extends UrlIdHandler { - private static final SoundcloudStreamUrlIdHandler instance = new SoundcloudStreamUrlIdHandler(); +public class SoundcloudStreamUIHFactory extends UIHFactory { + private static final SoundcloudStreamUIHFactory instance = new SoundcloudStreamUIHFactory(); private final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+" + "/(?!(tracks|albums|sets|reposts|followers|following)/?$)[0-9a-z_-]+/?([#?].*)?$"; - private SoundcloudStreamUrlIdHandler() { + private SoundcloudStreamUIHFactory() { } - public static SoundcloudStreamUrlIdHandler getInstance() { + public static SoundcloudStreamUIHFactory getInstance() { return instance; } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSubscriptionExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSubscriptionExtractor.java index d34a4f8d..5b5db292 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSubscriptionExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSubscriptionExtractor.java @@ -31,7 +31,7 @@ public class SoundcloudSubscriptionExtractor extends SubscriptionExtractor { String id; try { - id = service.getChannelUrlIdHandler().setUrl(getUrlFrom(channelUrl)).getId(); + id = service.getChannelUIHFactory().setUrl(getUrlFrom(channelUrl)).getId(); } catch (ExtractionException e) { throw new InvalidSourceException(e); } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java index fca63532..e425f1f5 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java @@ -1,9 +1,8 @@ package org.schabi.newpipe.extractor.services.youtube; -import org.schabi.newpipe.extractor.ListUrlIdHandler; -import org.schabi.newpipe.extractor.StreamingService; -import org.schabi.newpipe.extractor.SuggestionExtractor; -import org.schabi.newpipe.extractor.UrlIdHandler; +import org.schabi.newpipe.extractor.*; +import org.schabi.newpipe.extractor.ListUIHFactory; +import org.schabi.newpipe.extractor.UIHFactory; import org.schabi.newpipe.extractor.channel.ChannelExtractor; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.kiosk.KioskExtractor; @@ -11,7 +10,7 @@ import org.schabi.newpipe.extractor.kiosk.KioskList; import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; import org.schabi.newpipe.extractor.search.SearchEngine; import org.schabi.newpipe.extractor.search.SearchExtractor; -import org.schabi.newpipe.extractor.search.SearchQueryUrlHandler; +import org.schabi.newpipe.extractor.search.SearchQIHFactory; import org.schabi.newpipe.extractor.services.youtube.extractors.*; import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.*; import org.schabi.newpipe.extractor.stream.StreamExtractor; @@ -48,47 +47,42 @@ public class YoutubeService extends StreamingService { } @Override - public SearchEngine getSearchEngine() { - return new YoutubeSearchEngine(getServiceId()); - } - - @Override - public SearchExtractor getSearchExtractor(SearchQueryUrlHandler query, String contentCountry) { + public SearchExtractor getSearchExtractor(SearchQIHFactory query, String contentCountry) { return new YoutubeSearchExtractor(this, query, contentCountry); } @Override - public UrlIdHandler getStreamUrlIdHandler() { - return YoutubeStreamUrlIdHandler.getInstance(); + public UIHFactory getStreamUIHFactory() { + return YoutubeStreamUIHFactory.getInstance(); } @Override - public ListUrlIdHandler getChannelUrlIdHandler() { - return YoutubeChannelUrlIdHandler.getInstance(); + public ListUIHFactory getChannelUIHFactory() { + return YoutubeChannelUIHFactory.getInstance(); } @Override - public ListUrlIdHandler getPlaylistUrlIdHandler() { - return YoutubePlaylistUrlIdHandler.getInstance(); + public ListUIHFactory getPlaylistUIHFactory() { + return YoutubePlaylistUIHFactory.getInstance(); } @Override - public SearchQueryUrlHandler getSearchQueryHandler() { - return YoutubeSearchQueryUrlHandler.getInstance(); + public SearchQIHFactory getSearchQIHFactory() { + return YoutubeSearchQIHFactory.getInstance(); } @Override - public StreamExtractor getStreamExtractor(UrlIdHandler urlIdHandler) throws ExtractionException { - return new YoutubeStreamExtractor(this, urlIdHandler); + public StreamExtractor getStreamExtractor(UIHFactory UIHFactory) throws ExtractionException { + return new YoutubeStreamExtractor(this, UIHFactory); } @Override - public ChannelExtractor getChannelExtractor(ListUrlIdHandler urlIdHandler) throws ExtractionException { + public ChannelExtractor getChannelExtractor(ListUIHFactory urlIdHandler) throws ExtractionException { return new YoutubeChannelExtractor(this, urlIdHandler); } @Override - public PlaylistExtractor getPlaylistExtractor(ListUrlIdHandler urlIdHandler) throws ExtractionException { + public PlaylistExtractor getPlaylistExtractor(ListUIHFactory urlIdHandler) throws ExtractionException { return new YoutubePlaylistExtractor(this, urlIdHandler); } @@ -108,9 +102,9 @@ public class YoutubeService extends StreamingService { public KioskExtractor createNewKiosk(StreamingService streamingService, String url, String id) throws ExtractionException { return new YoutubeTrendingExtractor(YoutubeService.this, - new YoutubeTrendingUrlIdHandler().setUrl(url), id); + new YoutubeTrendingUIHFactory().setUrl(url), id); } - }, new YoutubeTrendingUrlIdHandler(), "Trending"); + }, new YoutubeTrendingUIHFactory(), "Trending"); list.setDefaultKiosk("Trending"); } catch (Exception e) { throw new ExtractionException(e); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java index a602f0ea..7abd7039 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeChannelExtractor.java @@ -48,7 +48,7 @@ public class YoutubeChannelExtractor extends ChannelExtractor { private Document doc; - public YoutubeChannelExtractor(StreamingService service, ListUrlIdHandler urlIdHandler) { + public YoutubeChannelExtractor(StreamingService service, ListUIHFactory urlIdHandler) { super(service, urlIdHandler); } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubePlaylistExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubePlaylistExtractor.java index 13f31a6c..7654ce98 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubePlaylistExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubePlaylistExtractor.java @@ -19,14 +19,12 @@ import org.schabi.newpipe.extractor.utils.Utils; import javax.annotation.Nonnull; import java.io.IOException; -import static org.schabi.newpipe.extractor.NewPipe.getDownloader; - @SuppressWarnings("WeakerAccess") public class YoutubePlaylistExtractor extends PlaylistExtractor { private Document doc; - public YoutubePlaylistExtractor(StreamingService service, ListUrlIdHandler urlIdHandler) throws ExtractionException { + public YoutubePlaylistExtractor(StreamingService service, ListUIHFactory urlIdHandler) throws ExtractionException { super(service, urlIdHandler); } @@ -175,7 +173,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor { private void collectStreamsFrom(StreamInfoItemsCollector collector, Element element) throws ParsingException { collector.reset(); - final UrlIdHandler streamUrlIdHandler = getService().getStreamUrlIdHandler(); + final UIHFactory streamUIHFactory = getService().getStreamUIHFactory(); for (final Element li : element.children()) { if(isDeletedItem(li)) { continue; @@ -192,7 +190,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor { @Override public String getUrl() throws ParsingException { try { - return streamUrlIdHandler.setId(li.attr("data-video-id")).getUrl(); + return streamUIHFactory.setId(li.attr("data-video-id")).getUrl(); } catch (Exception e) { throw new ParsingException("Could not get web page url for the video", e); } @@ -257,7 +255,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor { @Override public String getThumbnailUrl() throws ParsingException { try { - return "https://i.ytimg.com/vi/" + streamUrlIdHandler.setUrl(getUrl()).getId() + "/hqdefault.jpg"; + return "https://i.ytimg.com/vi/" + streamUIHFactory.setUrl(getUrl()).getId() + "/hqdefault.jpg"; } catch (Exception e) { throw new ParsingException("Could not get thumbnail url", e); } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeSearchExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeSearchExtractor.java index 5d51ed1e..af63be03 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeSearchExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeSearchExtractor.java @@ -5,15 +5,12 @@ import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.schabi.newpipe.extractor.Downloader; import org.schabi.newpipe.extractor.InfoItem; -import org.schabi.newpipe.extractor.InfoItemsCollector; 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.search.InfoItemsSearchCollector; -import org.schabi.newpipe.extractor.search.SearchEngine; import org.schabi.newpipe.extractor.search.SearchExtractor; -import org.schabi.newpipe.extractor.search.SearchQueryUrlHandler; -import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeSearchQueryUrlHandler; +import org.schabi.newpipe.extractor.search.SearchQIHFactory; import org.schabi.newpipe.extractor.utils.Parser; import javax.annotation.Nonnull; @@ -27,7 +24,7 @@ public class YoutubeSearchExtractor extends SearchExtractor { private Document doc; public YoutubeSearchExtractor(StreamingService service, - SearchQueryUrlHandler urlIdHandler, + SearchQIHFactory urlIdHandler, String contentCountry) { super(service, urlIdHandler, contentCountry); } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java index 87571e8b..b1e1552f 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java @@ -84,8 +84,8 @@ public class YoutubeStreamExtractor extends StreamExtractor { private boolean isAgeRestricted; - public YoutubeStreamExtractor(StreamingService service, UrlIdHandler urlIdHandler) throws ExtractionException { - super(service, urlIdHandler); + public YoutubeStreamExtractor(StreamingService service, UIHFactory UIHFactory) throws ExtractionException { + super(service, UIHFactory); } /*////////////////////////////////////////////////////////////////////////// diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeTrendingExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeTrendingExtractor.java index 94b9cc6c..d32125ca 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeTrendingExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeTrendingExtractor.java @@ -25,13 +25,11 @@ import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import org.schabi.newpipe.extractor.Downloader; -import org.schabi.newpipe.extractor.ListUrlIdHandler; +import org.schabi.newpipe.extractor.ListUIHFactory; import org.schabi.newpipe.extractor.StreamingService; -import org.schabi.newpipe.extractor.UrlIdHandler; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.kiosk.KioskExtractor; -import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeTrendingUrlIdHandler; import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector; @@ -42,7 +40,7 @@ public class YoutubeTrendingExtractor extends KioskExtractor { private Document doc; - public YoutubeTrendingExtractor(StreamingService service, ListUrlIdHandler urlIdHandler, String kioskId) + public YoutubeTrendingExtractor(StreamingService service, ListUIHFactory urlIdHandler, String kioskId) throws ExtractionException { super(service, urlIdHandler, kioskId); } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeChannelUrlIdHandler.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeChannelUIHFactory.java similarity index 82% rename from extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeChannelUrlIdHandler.java rename to extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeChannelUIHFactory.java index e6dbf09b..c95413cd 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeChannelUrlIdHandler.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeChannelUIHFactory.java @@ -1,6 +1,6 @@ package org.schabi.newpipe.extractor.services.youtube.urlIdHandlers; -import org.schabi.newpipe.extractor.ListUrlIdHandler; +import org.schabi.newpipe.extractor.ListUIHFactory; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.utils.Parser; @@ -8,7 +8,7 @@ import org.schabi.newpipe.extractor.utils.Parser; * Created by Christian Schabesberger on 25.07.16. * * Copyright (C) Christian Schabesberger 2016 - * YoutubeChannelUrlIdHandler.java is part of NewPipe. + * YoutubeChannelUIHFactory.java is part of NewPipe. * * NewPipe is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ import org.schabi.newpipe.extractor.utils.Parser; * along with NewPipe. If not, see . */ -public class YoutubeChannelUrlIdHandler extends ListUrlIdHandler { +public class YoutubeChannelUIHFactory extends ListUIHFactory { - private static final YoutubeChannelUrlIdHandler instance = new YoutubeChannelUrlIdHandler(); + private static final YoutubeChannelUIHFactory instance = new YoutubeChannelUIHFactory(); private static final String ID_PATTERN = "/(user/[A-Za-z0-9_-]*|channel/[A-Za-z0-9_-]*)"; - public static YoutubeChannelUrlIdHandler getInstance() { + public static YoutubeChannelUIHFactory getInstance() { return instance; } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubePlaylistUrlIdHandler.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubePlaylistUIHFactory.java similarity index 78% rename from extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubePlaylistUrlIdHandler.java rename to extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubePlaylistUIHFactory.java index 262cbfc2..d3daa3ea 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubePlaylistUrlIdHandler.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubePlaylistUIHFactory.java @@ -1,16 +1,16 @@ package org.schabi.newpipe.extractor.services.youtube.urlIdHandlers; -import org.schabi.newpipe.extractor.ListUrlIdHandler; +import org.schabi.newpipe.extractor.ListUIHFactory; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.utils.Parser; -public class YoutubePlaylistUrlIdHandler extends ListUrlIdHandler { +public class YoutubePlaylistUIHFactory extends ListUIHFactory { - private static final YoutubePlaylistUrlIdHandler instance = new YoutubePlaylistUrlIdHandler(); + private static final YoutubePlaylistUIHFactory instance = new YoutubePlaylistUIHFactory(); private static final String ID_PATTERN = "([\\-a-zA-Z0-9_]{10,})"; - public static YoutubePlaylistUrlIdHandler getInstance() { + public static YoutubePlaylistUIHFactory getInstance() { return instance; } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeSearchQueryUrlHandler.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeSearchQIHFactory.java similarity index 84% rename from extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeSearchQueryUrlHandler.java rename to extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeSearchQIHFactory.java index a562f609..1dbb9e15 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeSearchQueryUrlHandler.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeSearchQIHFactory.java @@ -1,12 +1,12 @@ package org.schabi.newpipe.extractor.services.youtube.urlIdHandlers; import org.schabi.newpipe.extractor.exceptions.ParsingException; -import org.schabi.newpipe.extractor.search.SearchQueryUrlHandler; +import org.schabi.newpipe.extractor.search.SearchQIHFactory; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -public class YoutubeSearchQueryUrlHandler extends SearchQueryUrlHandler { +public class YoutubeSearchQIHFactory extends SearchQIHFactory { public static final String CHARSET_UTF_8 = "UTF-8"; @@ -15,8 +15,8 @@ public class YoutubeSearchQueryUrlHandler extends SearchQueryUrlHandler { public static final String PLAYLIST = "playlist"; public static final String ANY = "any"; - public static YoutubeSearchQueryUrlHandler getInstance() { - return new YoutubeSearchQueryUrlHandler(); + public static YoutubeSearchQIHFactory getInstance() { + return new YoutubeSearchQIHFactory(); } @Override diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeStreamUrlIdHandler.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeStreamUIHFactory.java similarity index 94% rename from extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeStreamUrlIdHandler.java rename to extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeStreamUIHFactory.java index 75870662..10efba8b 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeStreamUrlIdHandler.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeStreamUIHFactory.java @@ -5,7 +5,7 @@ import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.schabi.newpipe.extractor.Downloader; import org.schabi.newpipe.extractor.NewPipe; -import org.schabi.newpipe.extractor.UrlIdHandler; +import org.schabi.newpipe.extractor.UIHFactory; import org.schabi.newpipe.extractor.exceptions.FoundAdException; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ReCaptchaException; @@ -21,7 +21,7 @@ import java.net.URLDecoder; * Created by Christian Schabesberger on 02.02.16. * * Copyright (C) Christian Schabesberger 2016 - * YoutubeStreamUrlIdHandler.java is part of NewPipe. + * YoutubeStreamUIHFactory.java is part of NewPipe. * * NewPipe is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,15 +37,15 @@ import java.net.URLDecoder; * along with NewPipe. If not, see . */ -public class YoutubeStreamUrlIdHandler extends UrlIdHandler { +public class YoutubeStreamUIHFactory extends UIHFactory { - private static final YoutubeStreamUrlIdHandler instance = new YoutubeStreamUrlIdHandler(); + private static final YoutubeStreamUIHFactory instance = new YoutubeStreamUIHFactory(); private static final String ID_PATTERN = "([\\-a-zA-Z0-9_]{11})"; - private YoutubeStreamUrlIdHandler() { + private YoutubeStreamUIHFactory() { } - public static YoutubeStreamUrlIdHandler getInstance() { + public static YoutubeStreamUIHFactory getInstance() { return instance; } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeTrendingUrlIdHandler.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeTrendingUIHFactory.java similarity index 81% rename from extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeTrendingUrlIdHandler.java rename to extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeTrendingUIHFactory.java index c3696cd7..9ee9a4e4 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeTrendingUrlIdHandler.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/urlIdHandlers/YoutubeTrendingUIHFactory.java @@ -4,7 +4,7 @@ package org.schabi.newpipe.extractor.services.youtube.urlIdHandlers; * Created by Christian Schabesberger on 12.08.17. * * Copyright (C) Christian Schabesberger 2017 - * YoutubeTrendingUrlIdHandler.java is part of NewPipe. + * YoutubeTrendingUIHFactory.java is part of NewPipe. * * NewPipe is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,12 +20,10 @@ package org.schabi.newpipe.extractor.services.youtube.urlIdHandlers; * along with NewPipe. If not, see . */ -import org.schabi.newpipe.extractor.ListUrlIdHandler; -import org.schabi.newpipe.extractor.UrlIdHandler; -import org.schabi.newpipe.extractor.exceptions.ParsingException; +import org.schabi.newpipe.extractor.ListUIHFactory; import org.schabi.newpipe.extractor.utils.Parser; -public class YoutubeTrendingUrlIdHandler extends ListUrlIdHandler { +public class YoutubeTrendingUIHFactory extends ListUIHFactory { public String getUrl() { return "https://www.youtube.com/feed/trending"; diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java index ff8c9f41..1bfa5625 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java @@ -23,7 +23,7 @@ package org.schabi.newpipe.extractor.stream; import org.schabi.newpipe.extractor.Extractor; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.Subtitles; -import org.schabi.newpipe.extractor.UrlIdHandler; +import org.schabi.newpipe.extractor.UIHFactory; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.utils.Parser; @@ -39,8 +39,8 @@ public abstract class StreamExtractor extends Extractor { public static final int NO_AGE_LIMIT = 0; - public StreamExtractor(StreamingService service, UrlIdHandler urlIdHandler) { - super(service, urlIdHandler); + public StreamExtractor(StreamingService service, UIHFactory UIHFactory) { + super(service, UIHFactory); } @Nonnull diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractorTest.java index a7723024..189e2f3d 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractorTest.java @@ -15,7 +15,7 @@ import static org.junit.Assert.*; import static org.schabi.newpipe.extractor.ServiceList.SoundCloud; /** - * Test for {@link SoundcloudChartsUrlIdHandler} + * Test for {@link SoundcloudChartsUIHFactory} */ public class SoundcloudChartsExtractorTest { diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUrlIdHandlerTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUIHFactoryTest.java similarity index 89% rename from extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUrlIdHandlerTest.java rename to extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUIHFactoryTest.java index 4fa09ffa..70920368 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUrlIdHandlerTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsUIHFactoryTest.java @@ -11,14 +11,14 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; /** - * Test for {@link SoundcloudChartsUrlIdHandler} + * Test for {@link SoundcloudChartsUIHFactory} */ -public class SoundcloudChartsUrlIdHandlerTest { - private static SoundcloudChartsUrlIdHandler urlIdHandler; +public class SoundcloudChartsUIHFactoryTest { + private static SoundcloudChartsUIHFactory urlIdHandler; @BeforeClass public static void setUp() throws Exception { - urlIdHandler = new SoundcloudChartsUrlIdHandler(); + urlIdHandler = new SoundcloudChartsUIHFactory(); NewPipe.init(Downloader.getInstance()); } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUrlIdHandlerTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUIHFactoryTest.java similarity index 94% rename from extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUrlIdHandlerTest.java rename to extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUIHFactoryTest.java index 5c1d35cf..5fb597d5 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUrlIdHandlerTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUIHFactoryTest.java @@ -12,14 +12,14 @@ import java.util.List; import static org.junit.Assert.*; /** - * Test for {@link SoundcloudStreamUrlIdHandler} + * Test for {@link SoundcloudStreamUIHFactory} */ -public class SoundcloudStreamUrlIdHandlerTest { - private static SoundcloudStreamUrlIdHandler urlIdHandler; +public class SoundcloudStreamUIHFactoryTest { + private static SoundcloudStreamUIHFactory urlIdHandler; @BeforeClass public static void setUp() throws Exception { - urlIdHandler = SoundcloudStreamUrlIdHandler.getInstance(); + urlIdHandler = SoundcloudStreamUIHFactory.getInstance(); NewPipe.init(Downloader.getInstance()); } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSubscriptionExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSubscriptionExtractorTest.java index e0e99803..c27569a9 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSubscriptionExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSubscriptionExtractorTest.java @@ -5,7 +5,7 @@ import org.junit.Test; import org.schabi.newpipe.Downloader; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.ServiceList; -import org.schabi.newpipe.extractor.UrlIdHandler; +import org.schabi.newpipe.extractor.UIHFactory; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor; import org.schabi.newpipe.extractor.subscription.SubscriptionItem; @@ -21,13 +21,13 @@ import static org.junit.Assert.*; */ public class SoundcloudSubscriptionExtractorTest { private static SoundcloudSubscriptionExtractor subscriptionExtractor; - private static UrlIdHandler urlHandler; + private static UIHFactory urlHandler; @BeforeClass public static void setupClass() { NewPipe.init(Downloader.getInstance()); subscriptionExtractor = new SoundcloudSubscriptionExtractor(ServiceList.SoundCloud); - urlHandler = ServiceList.SoundCloud.getChannelUrlIdHandler(); + urlHandler = ServiceList.SoundCloud.getChannelUIHFactory(); } @Test diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/search/SoundcloudSearchQUHTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/search/SoundcloudSearchQUHTest.java index ecc5cbdc..109af202 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/search/SoundcloudSearchQUHTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/soundcloud/search/SoundcloudSearchQUHTest.java @@ -4,7 +4,6 @@ import org.junit.BeforeClass; import org.junit.Test; import org.schabi.newpipe.Downloader; import org.schabi.newpipe.extractor.NewPipe; -import org.schabi.newpipe.extractor.services.soundcloud.SoundcloudSearchExtractor; import static java.util.Arrays.asList; import static org.junit.Assert.assertEquals; @@ -19,36 +18,36 @@ public class SoundcloudSearchQUHTest { @Test public void testRegularValues() throws Exception { - assertEquals("https://api-v2.soundcloud.com/search?q=asdf&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQueryHandler().setQuery("asdf").getUrl()); - assertEquals("https://api-v2.soundcloud.com/search?q=hans&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0",SoundCloud.getSearchQueryHandler().setQuery("hans").getUrl()); - assertEquals("https://api-v2.soundcloud.com/search?q=Poifj%26jaijf&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQueryHandler().setQuery("Poifj&jaijf").getUrl()); - assertEquals("https://api-v2.soundcloud.com/search?q=G%C3%BCl%C3%BCm&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQueryHandler().setQuery("Gülüm").getUrl()); - assertEquals("https://api-v2.soundcloud.com/search?q=%3Fj%24%29H%C2%A7B&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQueryHandler().setQuery("?j$)H§B").getUrl()); + assertEquals("https://api-v2.soundcloud.com/search?q=asdf&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQIHFactory().setQuery("asdf").getUrl()); + assertEquals("https://api-v2.soundcloud.com/search?q=hans&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0",SoundCloud.getSearchQIHFactory().setQuery("hans").getUrl()); + assertEquals("https://api-v2.soundcloud.com/search?q=Poifj%26jaijf&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQIHFactory().setQuery("Poifj&jaijf").getUrl()); + assertEquals("https://api-v2.soundcloud.com/search?q=G%C3%BCl%C3%BCm&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQIHFactory().setQuery("Gülüm").getUrl()); + assertEquals("https://api-v2.soundcloud.com/search?q=%3Fj%24%29H%C2%A7B&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQIHFactory().setQuery("?j$)H§B").getUrl()); } @Test public void testGetContentFilter() throws Exception { - assertEquals("tracks", SoundCloud.getSearchQueryHandler() + assertEquals("tracks", SoundCloud.getSearchQIHFactory() .setQuery("", asList(new String[]{"tracks"}), "").getContentFilter().get(0)); - assertEquals("users", SoundCloud.getSearchQueryHandler() + assertEquals("users", SoundCloud.getSearchQIHFactory() .setQuery("asdf", asList(new String[]{"users"}), "").getContentFilter().get(0)); } @Test public void testWithContentfilter() throws Exception { - assertEquals("https://api-v2.soundcloud.com/search/tracks?q=asdf&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQueryHandler() + assertEquals("https://api-v2.soundcloud.com/search/tracks?q=asdf&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQIHFactory() .setQuery("asdf", asList(new String[]{"tracks"}), "").getUrl()); - assertEquals("https://api-v2.soundcloud.com/search/users?q=asdf&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQueryHandler() + assertEquals("https://api-v2.soundcloud.com/search/users?q=asdf&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQIHFactory() .setQuery("asdf", asList(new String[]{"users"}), "").getUrl()); - assertEquals("https://api-v2.soundcloud.com/search/playlists?q=asdf&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQueryHandler() + assertEquals("https://api-v2.soundcloud.com/search/playlists?q=asdf&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQIHFactory() .setQuery("asdf", asList(new String[]{"playlist"}), "").getUrl()); - assertEquals("https://api-v2.soundcloud.com/search?q=asdf&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQueryHandler() + assertEquals("https://api-v2.soundcloud.com/search?q=asdf&client_id=rc0HfXXgVnLSGEuQMs1F8xxuAR2AL431&limit=10&offset=0", SoundCloud.getSearchQIHFactory() .setQuery("asdf", asList(new String[]{"fjiijie"}), "").getUrl()); } @Test public void testGetAvailableContentFilter() { - final String[] contentFilter = SoundCloud.getSearchQueryHandler().getAvailableContentFilter(); + final String[] contentFilter = SoundCloud.getSearchQIHFactory().getAvailableContentFilter(); assertEquals(4, contentFilter.length); assertEquals("tracks", contentFilter[0]); assertEquals("users", contentFilter[1]); @@ -58,7 +57,7 @@ public class SoundcloudSearchQUHTest { @Test public void testGetAvailableSortFilter() { - final String[] contentFilter = SoundCloud.getSearchQueryHandler().getAvailableSortFilter(); + final String[] contentFilter = SoundCloud.getSearchQIHFactory().getAvailableSortFilter(); assertEquals(0, contentFilter.length); } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelUrlIdHandlerTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelUIHFactoryTest.java similarity index 91% rename from extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelUrlIdHandlerTest.java rename to extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelUIHFactoryTest.java index 345d8b95..aff6aa35 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelUrlIdHandlerTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelUIHFactoryTest.java @@ -5,21 +5,21 @@ import org.junit.Test; import org.schabi.newpipe.Downloader; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.exceptions.ParsingException; -import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeChannelUrlIdHandler; +import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeChannelUIHFactory; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; /** - * Test for {@link YoutubeChannelUrlIdHandler} + * Test for {@link YoutubeChannelUIHFactory} */ -public class YoutubeChannelUrlIdHandlerTest { +public class YoutubeChannelUIHFactoryTest { - private static YoutubeChannelUrlIdHandler urlIdHandler; + private static YoutubeChannelUIHFactory urlIdHandler; @BeforeClass public static void setUp() { - urlIdHandler = YoutubeChannelUrlIdHandler.getInstance(); + urlIdHandler = YoutubeChannelUIHFactory.getInstance(); NewPipe.init(Downloader.getInstance()); } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorControversialTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorControversialTest.java index e36faeb2..a9a536d8 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorControversialTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorControversialTest.java @@ -8,7 +8,7 @@ import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor; -import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeStreamUrlIdHandler; +import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeStreamUIHFactory; import org.schabi.newpipe.extractor.stream.StreamExtractor; import org.schabi.newpipe.extractor.stream.SubtitlesFormat; import org.schabi.newpipe.extractor.stream.VideoStream; @@ -22,7 +22,7 @@ import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl; import static org.schabi.newpipe.extractor.ServiceList.YouTube; /** - * Test for {@link YoutubeStreamUrlIdHandler} + * Test for {@link YoutubeStreamUIHFactory} */ public class YoutubeStreamExtractorControversialTest { private static YoutubeStreamExtractor extractor; diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorRestrictedTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorRestrictedTest.java index 35d7760d..fd40a582 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorRestrictedTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorRestrictedTest.java @@ -8,7 +8,7 @@ import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor; -import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeStreamUrlIdHandler; +import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeStreamUIHFactory; import org.schabi.newpipe.extractor.stream.StreamExtractor; import org.schabi.newpipe.extractor.stream.SubtitlesFormat; import org.schabi.newpipe.extractor.stream.VideoStream; @@ -22,7 +22,7 @@ import static org.schabi.newpipe.extractor.ExtractorAsserts.assertIsSecureUrl; import static org.schabi.newpipe.extractor.ServiceList.YouTube; /** - * Test for {@link YoutubeStreamUrlIdHandler} + * Test for {@link YoutubeStreamUIHFactory} */ public class YoutubeStreamExtractorRestrictedTest { public static final String HTTPS = "https://"; diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUrlIdHandlerTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUIHFactoryTest.java similarity index 97% rename from extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUrlIdHandlerTest.java rename to extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUIHFactoryTest.java index 57f00079..57210b70 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUrlIdHandlerTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUIHFactoryTest.java @@ -6,7 +6,7 @@ import org.schabi.newpipe.Downloader; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.exceptions.FoundAdException; import org.schabi.newpipe.extractor.exceptions.ParsingException; -import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeStreamUrlIdHandler; +import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeStreamUIHFactory; import java.util.ArrayList; import java.util.List; @@ -14,15 +14,15 @@ import java.util.List; import static org.junit.Assert.*; /** - * Test for {@link YoutubeStreamUrlIdHandler} + * Test for {@link YoutubeStreamUIHFactory} */ -public class YoutubeStreamUrlIdHandlerTest { +public class YoutubeStreamUIHFactoryTest { private static String AD_URL = "https://googleads.g.doubleclick.net/aclk?sa=l&ai=C-2IPgeVTWPf4GcOStgfOnIOADf78n61GvKmmobYDrgIQASDj-5MDKAJg9ZXOgeAEoAGgy_T-A8gBAakC2gkpmquIsT6oAwGqBJMBT9BgD5kVgbN0dX602bFFaDw9vsxq-We-S8VkrXVBi6W_e7brZ36GCz1WO3EPEeklYuJjXLUowwCOKsd-8xr1UlS_tusuFJv9iX35xoBHKTRvs8-0aDbfEIm6in37QDfFuZjqgEMB8-tg0Jn_Pf1RU5OzbuU40B4Gy25NUTnOxhDKthOhKBUSZEksCEerUV8GMu10iAXCxquwApIFBggDEAEYAaAGGsgGlIjthrUDgAfItIsBqAemvhvYBwHSCAUIgGEQAbgT6AE&num=1&sig=AOD64_1DybDd4qAm5O7o9UAbTNRdqXXHFQ&ctype=21&video_id=dMO_IXYPZew&client=ca-pub-6219811747049371&adurl=http://www.youtube.com/watch%3Fv%3DdMO_IXYPZew"; - private static YoutubeStreamUrlIdHandler urlIdHandler; + private static YoutubeStreamUIHFactory urlIdHandler; @BeforeClass public static void setUp() { - urlIdHandler = YoutubeStreamUrlIdHandler.getInstance(); + urlIdHandler = YoutubeStreamUIHFactory.getInstance(); NewPipe.init(Downloader.getInstance()); } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSubscriptionExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSubscriptionExtractorTest.java index 6b5f2875..0e7adfbb 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSubscriptionExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSubscriptionExtractorTest.java @@ -5,7 +5,7 @@ import org.junit.Test; import org.schabi.newpipe.Downloader; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.ServiceList; -import org.schabi.newpipe.extractor.UrlIdHandler; +import org.schabi.newpipe.extractor.UIHFactory; import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeSubscriptionExtractor; import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor; import org.schabi.newpipe.extractor.subscription.SubscriptionItem; @@ -23,13 +23,13 @@ import static org.junit.Assert.*; */ public class YoutubeSubscriptionExtractorTest { private static YoutubeSubscriptionExtractor subscriptionExtractor; - private static UrlIdHandler urlHandler; + private static UIHFactory urlHandler; @BeforeClass public static void setupClass() { NewPipe.init(Downloader.getInstance()); subscriptionExtractor = new YoutubeSubscriptionExtractor(ServiceList.YouTube); - urlHandler = ServiceList.YouTube.getChannelUrlIdHandler(); + urlHandler = ServiceList.YouTube.getChannelUIHFactory(); } @Test 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 ae8c9f61..8ea4d91a 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 @@ -26,7 +26,7 @@ import org.schabi.newpipe.Downloader; import org.schabi.newpipe.extractor.ListExtractor; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeTrendingExtractor; -import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeTrendingUrlIdHandler; +import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeTrendingUIHFactory; import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.extractor.utils.Utils; @@ -37,7 +37,7 @@ import static org.schabi.newpipe.extractor.ServiceList.YouTube; /** - * Test for {@link YoutubeTrendingUrlIdHandler} + * Test for {@link YoutubeTrendingUIHFactory} */ public class YoutubeTrendingExtractorTest { 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 55f374a1..5265fe1f 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 @@ -25,7 +25,7 @@ import org.junit.Test; import org.schabi.newpipe.Downloader; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.StreamingService; -import org.schabi.newpipe.extractor.UrlIdHandler; +import org.schabi.newpipe.extractor.UIHFactory; import org.schabi.newpipe.extractor.kiosk.KioskInfo; import static org.junit.Assert.assertFalse; @@ -43,9 +43,9 @@ public class YoutubeTrendingKioskInfoTest { throws Exception { NewPipe.init(Downloader.getInstance()); StreamingService service = YouTube; - UrlIdHandler urlIdHandler = service.getKioskList().getUrlIdHandlerByType("Trending"); + UIHFactory UIHFactory = service.getKioskList().getUrlIdHandlerByType("Trending"); - kioskInfo = KioskInfo.getInfo(YouTube, urlIdHandler.setId("Trending").getUrl(), null); + kioskInfo = KioskInfo.getInfo(YouTube, UIHFactory.setId("Trending").getUrl(), null); } @Test diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingUIHFactoryTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingUIHFactoryTest.java new file mode 100644 index 00000000..fb9375e0 --- /dev/null +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingUIHFactoryTest.java @@ -0,0 +1,82 @@ +package org.schabi.newpipe.extractor.services.youtube; + +/* + * Created by Christian Schabesberger on 12.08.17. + * + * Copyright (C) Christian Schabesberger 2017 + * YoutubeTrendingUIHFactoryTest.java is part of NewPipe. + * + * NewPipe is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * NewPipe is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with NewPipe. If not, see . + */ + +import org.junit.BeforeClass; +import org.junit.Test; +import org.schabi.newpipe.Downloader; +import org.schabi.newpipe.extractor.NewPipe; +import org.schabi.newpipe.extractor.UIHFactory; +import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeTrendingUIHFactory; + +import static junit.framework.TestCase.assertFalse; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.schabi.newpipe.extractor.ServiceList.YouTube; + +/** + * Test for {@link YoutubeTrendingUIHFactory} + */ +public class YoutubeTrendingUIHFactoryTest { + private static UIHFactory UIHFactory; + + @BeforeClass + public static void setUp() throws Exception { + UIHFactory = YouTube.getKioskList().getUrlIdHandlerByType("Trending"); + NewPipe.init(Downloader.getInstance()); + } + + @Test + public void getUrl() + throws Exception { + assertEquals(UIHFactory.setId("").getUrl(), "https://www.youtube.com/feed/trending"); + } + + @Test + public void getId() + throws Exception { + assertEquals(UIHFactory.setUrl("").getId(), "Trending"); + } + + @Test + public void acceptUrl() { + assertTrue(UIHFactory.acceptUrl("https://www.youtube.com/feed/trending")); + assertTrue(UIHFactory.acceptUrl("https://www.youtube.com/feed/trending?adsf=fjaj#fhe")); + assertTrue(UIHFactory.acceptUrl("http://www.youtube.com/feed/trending")); + assertTrue(UIHFactory.acceptUrl("www.youtube.com/feed/trending")); + assertTrue(UIHFactory.acceptUrl("youtube.com/feed/trending")); + assertTrue(UIHFactory.acceptUrl("youtube.com/feed/trending?akdsakjf=dfije&kfj=dkjak")); + assertTrue(UIHFactory.acceptUrl("https://youtube.com/feed/trending")); + assertTrue(UIHFactory.acceptUrl("m.youtube.com/feed/trending")); + + assertFalse(UIHFactory.acceptUrl("https://youtu.be/feed/trending")); + assertFalse(UIHFactory.acceptUrl("kdskjfiiejfia")); + assertFalse(UIHFactory.acceptUrl("https://www.youtube.com/bullshit/feed/trending")); + assertFalse(UIHFactory.acceptUrl("https://www.youtube.com/feed/trending/bullshit")); + assertFalse(UIHFactory.acceptUrl("https://www.youtube.com/feed/bullshit/trending")); + assertFalse(UIHFactory.acceptUrl("peter klaut aepferl youtube.com/feed/trending")); + assertFalse(UIHFactory.acceptUrl("youtube.com/feed/trending askjkf")); + assertFalse(UIHFactory.acceptUrl("askdjfi youtube.com/feed/trending askjkf")); + assertFalse(UIHFactory.acceptUrl(" youtube.com/feed/trending")); + assertFalse(UIHFactory.acceptUrl("https://www.youtube.com/feed/trending.html")); + assertFalse(UIHFactory.acceptUrl("")); + } +} diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingUrlIdHandlerTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingUrlIdHandlerTest.java deleted file mode 100644 index 315bdbfc..00000000 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingUrlIdHandlerTest.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.schabi.newpipe.extractor.services.youtube; - -/* - * Created by Christian Schabesberger on 12.08.17. - * - * Copyright (C) Christian Schabesberger 2017 - * YoutubeTrendingUrlIdHandlerTest.java is part of NewPipe. - * - * NewPipe is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * NewPipe is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with NewPipe. If not, see . - */ - -import org.junit.BeforeClass; -import org.junit.Test; -import org.schabi.newpipe.Downloader; -import org.schabi.newpipe.extractor.NewPipe; -import org.schabi.newpipe.extractor.UrlIdHandler; -import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeTrendingUrlIdHandler; - -import static junit.framework.TestCase.assertFalse; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.schabi.newpipe.extractor.ServiceList.YouTube; - -/** - * Test for {@link YoutubeTrendingUrlIdHandler} - */ -public class YoutubeTrendingUrlIdHandlerTest { - private static UrlIdHandler urlIdHandler; - - @BeforeClass - public static void setUp() throws Exception { - urlIdHandler = YouTube.getKioskList().getUrlIdHandlerByType("Trending"); - NewPipe.init(Downloader.getInstance()); - } - - @Test - public void getUrl() - throws Exception { - assertEquals(urlIdHandler.setId("").getUrl(), "https://www.youtube.com/feed/trending"); - } - - @Test - public void getId() - throws Exception { - assertEquals(urlIdHandler.setUrl("").getId(), "Trending"); - } - - @Test - public void acceptUrl() { - assertTrue(urlIdHandler.acceptUrl("https://www.youtube.com/feed/trending")); - assertTrue(urlIdHandler.acceptUrl("https://www.youtube.com/feed/trending?adsf=fjaj#fhe")); - assertTrue(urlIdHandler.acceptUrl("http://www.youtube.com/feed/trending")); - assertTrue(urlIdHandler.acceptUrl("www.youtube.com/feed/trending")); - assertTrue(urlIdHandler.acceptUrl("youtube.com/feed/trending")); - assertTrue(urlIdHandler.acceptUrl("youtube.com/feed/trending?akdsakjf=dfije&kfj=dkjak")); - assertTrue(urlIdHandler.acceptUrl("https://youtube.com/feed/trending")); - assertTrue(urlIdHandler.acceptUrl("m.youtube.com/feed/trending")); - - assertFalse(urlIdHandler.acceptUrl("https://youtu.be/feed/trending")); - assertFalse(urlIdHandler.acceptUrl("kdskjfiiejfia")); - assertFalse(urlIdHandler.acceptUrl("https://www.youtube.com/bullshit/feed/trending")); - assertFalse(urlIdHandler.acceptUrl("https://www.youtube.com/feed/trending/bullshit")); - assertFalse(urlIdHandler.acceptUrl("https://www.youtube.com/feed/bullshit/trending")); - assertFalse(urlIdHandler.acceptUrl("peter klaut aepferl youtube.com/feed/trending")); - assertFalse(urlIdHandler.acceptUrl("youtube.com/feed/trending askjkf")); - assertFalse(urlIdHandler.acceptUrl("askdjfi youtube.com/feed/trending askjkf")); - assertFalse(urlIdHandler.acceptUrl(" youtube.com/feed/trending")); - assertFalse(urlIdHandler.acceptUrl("https://www.youtube.com/feed/trending.html")); - assertFalse(urlIdHandler.acceptUrl("")); - } -} diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchQUHTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchQUHTest.java index 322c9e75..09d95f31 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchQUHTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchQUHTest.java @@ -2,8 +2,6 @@ package org.schabi.newpipe.extractor.services.youtube.search; import org.junit.Test; -import java.util.ArrayList; - import static java.util.Arrays.asList; import static org.junit.Assert.assertEquals; import static org.schabi.newpipe.extractor.ServiceList.YouTube; @@ -12,36 +10,36 @@ public class YoutubeSearchQUHTest { @Test public void testRegularValues() throws Exception { - assertEquals("https://www.youtube.com/results?q=asdf", YouTube.getSearchQueryHandler().setQuery("asdf").getUrl()); - assertEquals("https://www.youtube.com/results?q=hans",YouTube.getSearchQueryHandler().setQuery("hans").getUrl()); - assertEquals("https://www.youtube.com/results?q=Poifj%26jaijf", YouTube.getSearchQueryHandler().setQuery("Poifj&jaijf").getUrl()); - assertEquals("https://www.youtube.com/results?q=G%C3%BCl%C3%BCm", YouTube.getSearchQueryHandler().setQuery("Gülüm").getUrl()); - assertEquals("https://www.youtube.com/results?q=%3Fj%24%29H%C2%A7B", YouTube.getSearchQueryHandler().setQuery("?j$)H§B").getUrl()); + assertEquals("https://www.youtube.com/results?q=asdf", YouTube.getSearchQIHFactory().setQuery("asdf").getUrl()); + assertEquals("https://www.youtube.com/results?q=hans",YouTube.getSearchQIHFactory().setQuery("hans").getUrl()); + assertEquals("https://www.youtube.com/results?q=Poifj%26jaijf", YouTube.getSearchQIHFactory().setQuery("Poifj&jaijf").getUrl()); + assertEquals("https://www.youtube.com/results?q=G%C3%BCl%C3%BCm", YouTube.getSearchQIHFactory().setQuery("Gülüm").getUrl()); + assertEquals("https://www.youtube.com/results?q=%3Fj%24%29H%C2%A7B", YouTube.getSearchQIHFactory().setQuery("?j$)H§B").getUrl()); } @Test public void testGetContentFilter() throws Exception { - assertEquals("stream", YouTube.getSearchQueryHandler() + assertEquals("stream", YouTube.getSearchQIHFactory() .setQuery("", asList(new String[]{"stream"}), "").getContentFilter().get(0)); - assertEquals("channel", YouTube.getSearchQueryHandler() + assertEquals("channel", YouTube.getSearchQIHFactory() .setQuery("asdf", asList(new String[]{"channel"}), "").getContentFilter().get(0)); } @Test public void testWithContentfilter() throws Exception { - assertEquals("https://www.youtube.com/results?q=asdf&sp=EgIQAVAU", YouTube.getSearchQueryHandler() + assertEquals("https://www.youtube.com/results?q=asdf&sp=EgIQAVAU", YouTube.getSearchQIHFactory() .setQuery("asdf", asList(new String[]{"stream"}), "").getUrl()); - assertEquals("https://www.youtube.com/results?q=asdf&sp=EgIQAlAU", YouTube.getSearchQueryHandler() + assertEquals("https://www.youtube.com/results?q=asdf&sp=EgIQAlAU", YouTube.getSearchQIHFactory() .setQuery("asdf", asList(new String[]{"channel"}), "").getUrl()); - assertEquals("https://www.youtube.com/results?q=asdf&sp=EgIQA1AU", YouTube.getSearchQueryHandler() + assertEquals("https://www.youtube.com/results?q=asdf&sp=EgIQA1AU", YouTube.getSearchQIHFactory() .setQuery("asdf", asList(new String[]{"playlist"}), "").getUrl()); - assertEquals("https://www.youtube.com/results?q=asdf", YouTube.getSearchQueryHandler() + assertEquals("https://www.youtube.com/results?q=asdf", YouTube.getSearchQIHFactory() .setQuery("asdf", asList(new String[]{"fjiijie"}), "").getUrl()); } @Test public void testGetAvailableContentFilter() { - final String[] contentFilter = YouTube.getSearchQueryHandler().getAvailableContentFilter(); + final String[] contentFilter = YouTube.getSearchQIHFactory().getAvailableContentFilter(); assertEquals(4, contentFilter.length); assertEquals("stream", contentFilter[0]); assertEquals("channel", contentFilter[1]); @@ -51,7 +49,7 @@ public class YoutubeSearchQUHTest { @Test public void testGetAvailableSortFilter() { - final String[] contentFilter = YouTube.getSearchQueryHandler().getAvailableSortFilter(); + final String[] contentFilter = YouTube.getSearchQIHFactory().getAvailableSortFilter(); assertEquals(0, contentFilter.length); } }