rename uih and remove afiliate link foo

This commit is contained in:
Christian Schabesberger 2018-07-13 18:02:40 +02:00
parent a1aaca1bea
commit 28788a05db
59 changed files with 334 additions and 427 deletions

View File

@ -2,8 +2,7 @@ package org.schabi.newpipe.extractor;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.uih.UIHandler;
import org.schabi.newpipe.extractor.uih.UIHandler;
import org.schabi.newpipe.extractor.linkhandler.LinkHandler;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -16,15 +15,15 @@ public abstract class Extractor {
*/
private final StreamingService service;
private final org.schabi.newpipe.extractor.uih.UIHandler uIHandler;
private final LinkHandler uIHandler;
@Nullable
private boolean pageFetched = false;
private final Downloader downloader;
public Extractor(final StreamingService service, final UIHandler uIHandler) {
public Extractor(final StreamingService service, final LinkHandler uIHandler) {
if(service == null) throw new NullPointerException("service is null");
if(uIHandler == null) throw new NullPointerException("UIHandler is null");
if(uIHandler == null) throw new NullPointerException("LinkHandler is null");
this.service = service;
this.uIHandler = uIHandler;
this.downloader = NewPipe.getDownloader();
@ -32,10 +31,10 @@ public abstract class Extractor {
}
/**
* @return The {@link UIHandler} of the current extractor object (e.g. a ChannelExtractor should return a channel url handler).
* @return The {@link LinkHandler} of the current extractor object (e.g. a ChannelExtractor should return a channel url handler).
*/
@Nonnull
public UIHandler getUIHandler() {
public LinkHandler getUIHandler() {
return uIHandler;
}

View File

@ -1,8 +1,6 @@
package org.schabi.newpipe.extractor;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.uih.UIHFactory;
import org.schabi.newpipe.extractor.uih.UIHandler;
import org.schabi.newpipe.extractor.linkhandler.LinkHandler;
import java.io.Serializable;
import java.util.ArrayList;
@ -20,7 +18,7 @@ public abstract class Info implements Serializable {
/**
* Different than the {@link #originalUrl} in the sense that it <i>may</i> be set as a cleaned url.
*
* @see UIHandler#getUrl()
* @see LinkHandler#getUrl()
* @see Extractor#getOriginalUrl()
*/
private final String url;
@ -50,11 +48,11 @@ public abstract class Info implements Serializable {
this.name = name;
}
public Info(int serviceId, UIHandler uiHandler, String name) {
public Info(int serviceId, LinkHandler linkHandler, String name) {
this(serviceId,
uiHandler.getId(),
uiHandler.getUrl(),
uiHandler.getOriginalUrl(),
linkHandler.getId(),
linkHandler.getUrl(),
linkHandler.getOriginalUrl(),
name);
}

View File

@ -1,11 +1,9 @@
package org.schabi.newpipe.extractor;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
import org.schabi.newpipe.extractor.uih.ListUIHandler;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import javax.annotation.Nonnull;
import javax.swing.plaf.ListUI;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
@ -15,7 +13,7 @@ import java.util.List;
*/
public abstract class ListExtractor<R extends InfoItem> extends Extractor {
public ListExtractor(StreamingService service, ListUIHandler uiHandler) {
public ListExtractor(StreamingService service, ListLinkHandler uiHandler) {
super(service, uiHandler);
}
@ -53,8 +51,8 @@ public abstract class ListExtractor<R extends InfoItem> extends Extractor {
}
@Override
public ListUIHandler getUIHandler() {
return (ListUIHandler) super.getUIHandler();
public ListLinkHandler getUIHandler() {
return (ListLinkHandler) super.getUIHandler();
}
/*//////////////////////////////////////////////////////////////////////////

View File

@ -1,6 +1,6 @@
package org.schabi.newpipe.extractor;
import org.schabi.newpipe.extractor.uih.ListUIHandler;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import java.util.List;
@ -22,7 +22,7 @@ public abstract class ListInfo<T extends InfoItem> extends Info {
this.sortFilter = sortFilter;
}
public ListInfo(int serviceId, ListUIHandler listUrlIdHandler, String name) {
public ListInfo(int serviceId, ListLinkHandler listUrlIdHandler, String name) {
super(serviceId, listUrlIdHandler, name);
this.contentFilters = listUrlIdHandler.getContentFilters();
this.sortFilter = listUrlIdHandler.getSortFilter();

View File

@ -6,7 +6,7 @@ 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.SearchExtractor;
import org.schabi.newpipe.extractor.uih.*;
import org.schabi.newpipe.extractor.linkhandler.*;
import org.schabi.newpipe.extractor.stream.StreamExtractor;
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
@ -67,23 +67,23 @@ public abstract class StreamingService {
////////////////////////////////////////////
// Url Id handler
////////////////////////////////////////////
public abstract UIHFactory getStreamUIHFactory();
public abstract ListUIHFactory getChannelUIHFactory();
public abstract ListUIHFactory getPlaylistUIHFactory();
public abstract SearchQIHFactory getSearchQIHFactory();
public abstract LinkHandlerFactory getStreamUIHFactory();
public abstract ListLinkHandlerFactory getChannelUIHFactory();
public abstract ListLinkHandlerFactory getPlaylistUIHFactory();
public abstract SearchQueryHandlerFactory getSearchQIHFactory();
////////////////////////////////////////////
// Extractor
////////////////////////////////////////////
public abstract SearchExtractor getSearchExtractor(SearchQIHandler queryHandler, String contentCountry);
public abstract SearchExtractor getSearchExtractor(SearchQueryHandler queryHandler, String contentCountry);
public abstract SuggestionExtractor getSuggestionExtractor();
public abstract SubscriptionExtractor getSubscriptionExtractor();
public abstract KioskList getKioskList() throws ExtractionException;
public abstract ChannelExtractor getChannelExtractor(ListUIHandler urlIdHandler) throws ExtractionException;
public abstract PlaylistExtractor getPlaylistExtractor(ListUIHandler urlIdHandler) throws ExtractionException;
public abstract StreamExtractor getStreamExtractor(UIHandler UIHFactory) throws ExtractionException;
public abstract ChannelExtractor getChannelExtractor(ListLinkHandler urlIdHandler) throws ExtractionException;
public abstract PlaylistExtractor getPlaylistExtractor(ListLinkHandler urlIdHandler) throws ExtractionException;
public abstract StreamExtractor getStreamExtractor(LinkHandler UIHFactory) throws ExtractionException;
public SearchExtractor getSearchExtractor(String query, List<String> contentFilter, String sortFilter, String contentCountry) throws ExtractionException {
return getSearchExtractor(getSearchQIHFactory().fromQuery(query, contentFilter, sortFilter), contentCountry);
@ -119,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 {
UIHFactory sH = getStreamUIHFactory();
UIHFactory cH = getChannelUIHFactory();
UIHFactory pH = getPlaylistUIHFactory();
LinkHandlerFactory sH = getStreamUIHFactory();
LinkHandlerFactory cH = getChannelUIHFactory();
LinkHandlerFactory pH = getPlaylistUIHFactory();
if (sH.acceptUrl(url)) {
return LinkType.STREAM;

View File

@ -4,7 +4,7 @@ import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.uih.ListUIHandler;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
/*
* Created by Christian Schabesberger on 25.07.16.
@ -28,7 +28,7 @@ import org.schabi.newpipe.extractor.uih.ListUIHandler;
public abstract class ChannelExtractor extends ListExtractor<StreamInfoItem> {
public ChannelExtractor(StreamingService service, ListUIHandler urlIdHandler) {
public ChannelExtractor(StreamingService service, ListLinkHandler urlIdHandler) {
super(service, urlIdHandler);
}

View File

@ -2,13 +2,12 @@ package org.schabi.newpipe.extractor.channel;
import org.schabi.newpipe.extractor.ListExtractor.InfoItemsPage;
import org.schabi.newpipe.extractor.ListInfo;
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.uih.ListUIHandler;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import org.schabi.newpipe.extractor.utils.ExtractorHelper;
import java.io.IOException;
@ -35,7 +34,7 @@ import java.io.IOException;
public class ChannelInfo extends ListInfo<StreamInfoItem> {
public ChannelInfo(int serviceId, ListUIHandler urlIdHandler, String name) throws ParsingException {
public ChannelInfo(int serviceId, ListLinkHandler urlIdHandler, String name) throws ParsingException {
super(serviceId, urlIdHandler, name);
}

View File

@ -21,11 +21,10 @@ package org.schabi.newpipe.extractor.kiosk;
*/
import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.uih.ListUIHandler;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import javax.annotation.Nonnull;
@ -34,7 +33,7 @@ public abstract class KioskExtractor extends ListExtractor<StreamInfoItem> {
private final String id;
public KioskExtractor(StreamingService streamingService,
ListUIHandler urlIdHandler,
ListLinkHandler urlIdHandler,
String kioskId) {
super(streamingService, urlIdHandler);
this.id = kioskId;

View File

@ -24,15 +24,14 @@ import org.schabi.newpipe.extractor.*;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
import org.schabi.newpipe.extractor.uih.ListUIHandler;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import org.schabi.newpipe.extractor.utils.ExtractorHelper;
import java.io.IOException;
public class KioskInfo extends ListInfo<StreamInfoItem> {
private KioskInfo(int serviceId, ListUIHandler urlIdHandler, String name) throws ParsingException {
private KioskInfo(int serviceId, ListLinkHandler urlIdHandler, String name) throws ParsingException {
super(serviceId, urlIdHandler, name);
}

View File

@ -2,9 +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.uih.ListUIHFactory;
import org.schabi.newpipe.extractor.uih.ListUIHandler;
import org.schabi.newpipe.extractor.uih.UIHFactory;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import java.io.IOException;
@ -25,19 +23,19 @@ public class KioskList {
private String defaultKiosk = null;
private class KioskEntry {
public KioskEntry(KioskExtractorFactory ef, ListUIHFactory h) {
public KioskEntry(KioskExtractorFactory ef, ListLinkHandlerFactory h) {
extractorFactory = ef;
handlerFactory = h;
}
final KioskExtractorFactory extractorFactory;
final ListUIHFactory handlerFactory;
final ListLinkHandlerFactory handlerFactory;
}
public KioskList(int service_id) {
this.service_id = service_id;
}
public void addKioskEntry(KioskExtractorFactory extractorFactory, ListUIHFactory handlerFactory, String id)
public void addKioskEntry(KioskExtractorFactory extractorFactory, ListLinkHandlerFactory handlerFactory, String id)
throws Exception {
if(kioskList.get(id) != null) {
throw new Exception("Kiosk with type " + id + " already exists.");
@ -94,7 +92,7 @@ public class KioskList {
throw new ExtractionException("Could not find a kiosk that fits to the url: " + url);
}
public ListUIHFactory getUIHFactoryByType(String type) {
public ListLinkHandlerFactory getUIHFactoryByType(String type) {
return kioskList.get(type).handlerFactory;
}
}

View File

@ -1,19 +1,19 @@
package org.schabi.newpipe.extractor.uih;
package org.schabi.newpipe.extractor.linkhandler;
import java.io.Serializable;
public class UIHandler implements Serializable {
public class LinkHandler implements Serializable {
protected final String originalUrl;
protected final String url;
protected final String id;
public UIHandler(String originalUrl, String url, String id) {
public LinkHandler(String originalUrl, String url, String id) {
this.originalUrl = originalUrl;
this.url = url;
this.id = id;
}
public UIHandler(UIHandler handler) {
public LinkHandler(LinkHandler handler) {
this(handler.originalUrl, handler.url, handler.id);
}

View File

@ -1,4 +1,4 @@
package org.schabi.newpipe.extractor.uih;
package org.schabi.newpipe.extractor.linkhandler;
import org.schabi.newpipe.extractor.exceptions.FoundAdException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
@ -7,7 +7,7 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException;
* Created by Christian Schabesberger on 26.07.16.
*
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
* UIHFactory.java is part of NewPipe.
* LinkHandlerFactory.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 +23,7 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException;
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public abstract class UIHFactory {
public abstract class LinkHandlerFactory {
///////////////////////////////////
// To Override
@ -37,20 +37,20 @@ public abstract class UIHFactory {
// Logic
///////////////////////////////////
public UIHandler fromUrl(String url) throws ParsingException {
public LinkHandler fromUrl(String url) throws ParsingException {
if(url == null) throw new IllegalArgumentException("url can not be null");
if(!acceptUrl(url)) {
throw new ParsingException("Malformed unacceptable url: " + url);
}
final String id = getId(url);
return new UIHandler(url, getUrl(id), id);
return new LinkHandler(url, getUrl(id), id);
}
public UIHandler fromId(String id) throws ParsingException {
public LinkHandler fromId(String id) throws ParsingException {
if(id == null) throw new IllegalArgumentException("id can not be null");
final String url = getUrl(id);
return new UIHandler(url, url, id);
return new LinkHandler(url, url, id);
}
/**

View File

@ -1,23 +1,23 @@
package org.schabi.newpipe.extractor.uih;
package org.schabi.newpipe.extractor.linkhandler;
import java.util.Collections;
import java.util.List;
public class ListUIHandler extends UIHandler {
public class ListLinkHandler extends LinkHandler {
protected final List<String> contentFilters;
protected final String sortFilter;
public ListUIHandler(String originalUrl,
String url,
String id,
List<String> contentFilters,
String sortFilter) {
public ListLinkHandler(String originalUrl,
String url,
String id,
List<String> contentFilters,
String sortFilter) {
super(originalUrl, url, id);
this.contentFilters = Collections.unmodifiableList(contentFilters);
this.sortFilter = sortFilter;
}
public ListUIHandler(ListUIHandler handler) {
public ListLinkHandler(ListLinkHandler handler) {
this(handler.originalUrl,
handler.url,
handler.id,
@ -25,9 +25,9 @@ public class ListUIHandler extends UIHandler {
handler.sortFilter);
}
public ListUIHandler(UIHandler handler,
List<String> contentFilters,
String sortFilter) {
public ListLinkHandler(LinkHandler handler,
List<String> contentFilters,
String sortFilter) {
this(handler.originalUrl,
handler.url,
handler.id,

View File

@ -1,12 +1,11 @@
package org.schabi.newpipe.extractor.uih;
package org.schabi.newpipe.extractor.linkhandler;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public abstract class ListUIHFactory extends UIHFactory {
public abstract class ListLinkHandlerFactory extends LinkHandlerFactory {
///////////////////////////////////
// To Override
@ -22,27 +21,27 @@ public abstract class ListUIHFactory extends UIHFactory {
@Override
public ListUIHandler fromUrl(String url) throws ParsingException {
public ListLinkHandler fromUrl(String url) throws ParsingException {
if(url == null) throw new IllegalArgumentException("url may not be null");
return new ListUIHandler(super.fromUrl(url), getContentFilter(url), getSortFilter(url));
return new ListLinkHandler(super.fromUrl(url), getContentFilter(url), getSortFilter(url));
}
@Override
public ListUIHandler fromId(String id) throws ParsingException {
return new ListUIHandler(super.fromId(id), new ArrayList<String>(0), "");
public ListLinkHandler fromId(String id) throws ParsingException {
return new ListLinkHandler(super.fromId(id), new ArrayList<String>(0), "");
}
public ListUIHandler fromQuery(String id,
List<String> contentFilters,
String sortFilter) throws ParsingException {
public ListLinkHandler fromQuery(String id,
List<String> contentFilters,
String sortFilter) throws ParsingException {
final String url = getUrl(id, contentFilters, sortFilter);
return new ListUIHandler(url, url, id, contentFilters, sortFilter);
return new ListLinkHandler(url, url, id, contentFilters, sortFilter);
}
/**
* For makeing ListUIHFactory compatible with UIHFactory we need to override this,
* For makeing ListLinkHandlerFactory compatible with LinkHandlerFactory we need to override this,
* however it should not be overridden by the actual implementation.
* @param id
* @return the url coresponding to id without any filters applied

View File

@ -1,18 +1,18 @@
package org.schabi.newpipe.extractor.uih;
package org.schabi.newpipe.extractor.linkhandler;
import java.util.List;
public class SearchQIHandler extends ListUIHandler {
public class SearchQueryHandler extends ListLinkHandler {
public SearchQIHandler(String originalUrl,
String url,
String searchString,
List<String> contentFilters,
String sortFilter) {
public SearchQueryHandler(String originalUrl,
String url,
String searchString,
List<String> contentFilters,
String sortFilter) {
super(originalUrl, url, searchString, contentFilters, sortFilter);
}
public SearchQIHandler(ListUIHandler handler) {
public SearchQueryHandler(ListLinkHandler handler) {
this(handler.originalUrl,
handler.url,
handler.id,
@ -22,7 +22,7 @@ public class SearchQIHandler extends ListUIHandler {
/**
* Returns the search string. Since ListQIHandler is based on ListUIHandler
* Returns the search string. Since ListQIHandler is based on ListLinkHandler
* getSearchString() is equivalent to calling getId().
* @return the search string
*/

View File

@ -1,11 +1,11 @@
package org.schabi.newpipe.extractor.uih;
package org.schabi.newpipe.extractor.linkhandler;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import java.util.ArrayList;
import java.util.List;
public abstract class SearchQIHFactory extends ListUIHFactory {
public abstract class SearchQueryHandlerFactory extends ListLinkHandlerFactory {
///////////////////////////////////
// To Override
@ -23,13 +23,13 @@ public abstract class SearchQIHFactory extends ListUIHFactory {
public String getId(String url) { return getSearchString(url); }
@Override
public SearchQIHandler fromQuery(String querry,
List<String> contentFilter,
String sortFilter) throws ParsingException {
return new SearchQIHandler(super.fromQuery(querry, contentFilter, sortFilter));
public SearchQueryHandler fromQuery(String querry,
List<String> contentFilter,
String sortFilter) throws ParsingException {
return new SearchQueryHandler(super.fromQuery(querry, contentFilter, sortFilter));
}
public SearchQIHandler fromQuery(String querry) throws ParsingException {
public SearchQueryHandler fromQuery(String querry) throws ParsingException {
return fromQuery(querry, new ArrayList<String>(0), "");
}

View File

@ -1,15 +1,14 @@
package org.schabi.newpipe.extractor.playlist;
import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.uih.ListUIHandler;
public abstract class PlaylistExtractor extends ListExtractor<StreamInfoItem> {
public PlaylistExtractor(StreamingService service, ListUIHandler urlIdHandler) {
public PlaylistExtractor(StreamingService service, ListLinkHandler urlIdHandler) {
super(service, urlIdHandler);
}

View File

@ -2,20 +2,19 @@ package org.schabi.newpipe.extractor.playlist;
import org.schabi.newpipe.extractor.ListExtractor.InfoItemsPage;
import org.schabi.newpipe.extractor.ListInfo;
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.uih.ListUIHandler;
import org.schabi.newpipe.extractor.utils.ExtractorHelper;
import java.io.IOException;
public class PlaylistInfo extends ListInfo<StreamInfoItem> {
private PlaylistInfo(int serviceId, ListUIHandler urlIdHandler, String name) throws ParsingException {
private PlaylistInfo(int serviceId, ListLinkHandler urlIdHandler, String name) throws ParsingException {
super(serviceId, urlIdHandler, name);
}

View File

@ -5,8 +5,7 @@ import org.schabi.newpipe.extractor.ListExtractor;
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.uih.SearchQIHFactory;
import org.schabi.newpipe.extractor.uih.SearchQIHandler;
import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandler;
public abstract class SearchExtractor extends ListExtractor<InfoItem> {
@ -19,7 +18,7 @@ public abstract class SearchExtractor extends ListExtractor<InfoItem> {
private final InfoItemsSearchCollector collector;
private final String contentCountry;
public SearchExtractor(StreamingService service, SearchQIHandler urlIdHandler, String contentCountry) {
public SearchExtractor(StreamingService service, SearchQueryHandler urlIdHandler, String contentCountry) {
super(service, urlIdHandler);
collector = new InfoItemsSearchCollector(service.getServiceId());
this.contentCountry = contentCountry;
@ -36,8 +35,8 @@ public abstract class SearchExtractor extends ListExtractor<InfoItem> {
}
@Override
public SearchQIHandler getUIHandler() {
return (SearchQIHandler) super.getUIHandler();
public SearchQueryHandler getUIHandler() {
return (SearchQueryHandler) super.getUIHandler();
}
@Override

View File

@ -5,8 +5,7 @@ import org.schabi.newpipe.extractor.ListExtractor;
import org.schabi.newpipe.extractor.ListInfo;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.stream.Stream;
import org.schabi.newpipe.extractor.uih.SearchQIHandler;
import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandler;
import org.schabi.newpipe.extractor.utils.ExtractorHelper;
import java.io.IOException;
@ -18,14 +17,14 @@ public class SearchInfo extends ListInfo<InfoItem> {
private String searchSuggestion;
public SearchInfo(int serviceId,
SearchQIHandler qIHandler,
SearchQueryHandler qIHandler,
String searchString) {
super(serviceId, qIHandler, "Search");
this.searchString = searchString;
}
public static SearchInfo getInfo(StreamingService service, SearchQIHandler searchQuery, String contentCountry) throws ExtractionException, IOException {
public static SearchInfo getInfo(StreamingService service, SearchQueryHandler searchQuery, String contentCountry) throws ExtractionException, IOException {
SearchExtractor extractor = service.getSearchExtractor(searchQuery, contentCountry);
extractor.fetchPage();
return getInfo(extractor);
@ -52,7 +51,7 @@ public class SearchInfo extends ListInfo<InfoItem> {
public static ListExtractor.InfoItemsPage<InfoItem> getMoreItems(StreamingService service,
SearchQIHandler query,
SearchQueryHandler query,
String contentCountry,
String pageUrl)
throws IOException, ExtractionException {

View File

@ -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.uih.ListUIHandler;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
@ -24,7 +24,7 @@ public class SoundcloudChannelExtractor extends ChannelExtractor {
private StreamInfoItemsCollector streamInfoItemsCollector = null;
private String nextPageUrl = null;
public SoundcloudChannelExtractor(StreamingService service, ListUIHandler urlIdHandler) {
public SoundcloudChannelExtractor(StreamingService service, ListLinkHandler urlIdHandler) {
super(service, urlIdHandler);
}

View File

@ -1,18 +1,18 @@
package org.schabi.newpipe.extractor.services.soundcloud;
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.utils.Parser;
import org.schabi.newpipe.extractor.utils.Utils;
import java.util.List;
public class SoundcloudChannelUIHFactory extends ListUIHFactory {
private static final SoundcloudChannelUIHFactory instance = new SoundcloudChannelUIHFactory();
public class SoundcloudChannelLinkHandlerFactory extends ListLinkHandlerFactory {
private static final SoundcloudChannelLinkHandlerFactory instance = new SoundcloudChannelLinkHandlerFactory();
private final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+" +
"(/((tracks|albums|sets|reposts|followers|following)/?)?)?([#?].*)?$";
public static SoundcloudChannelUIHFactory getInstance() {
public static SoundcloudChannelLinkHandlerFactory getInstance() {
return instance;
}

View File

@ -1,7 +1,7 @@
package org.schabi.newpipe.extractor.services.soundcloud;
import org.schabi.newpipe.extractor.Downloader;
import org.schabi.newpipe.extractor.uih.ListUIHandler;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.kiosk.KioskExtractor;
@ -17,7 +17,7 @@ public class SoundcloudChartsExtractor extends KioskExtractor {
private StreamInfoItemsCollector collector = null;
private String nextPageUrl = null;
public SoundcloudChartsExtractor(StreamingService service, ListUIHandler urlIdHandler, String kioskId) {
public SoundcloudChartsExtractor(StreamingService service, ListLinkHandler urlIdHandler, String kioskId) {
super(service, urlIdHandler, kioskId);
}

View File

@ -1,11 +1,11 @@
package org.schabi.newpipe.extractor.services.soundcloud;
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
import org.schabi.newpipe.extractor.utils.Parser;
import java.util.List;
public class SoundcloudChartsUIHFactory extends ListUIHFactory {
public class SoundcloudChartsLinkHandlerFactory extends ListLinkHandlerFactory {
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)?/?([#?].*)?$";

View File

@ -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.uih.ListUIHandler;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
@ -23,7 +23,7 @@ public class SoundcloudPlaylistExtractor extends PlaylistExtractor {
private StreamInfoItemsCollector streamInfoItemsCollector = null;
private String nextPageUrl = null;
public SoundcloudPlaylistExtractor(StreamingService service, ListUIHandler urlIdHandler) {
public SoundcloudPlaylistExtractor(StreamingService service, ListLinkHandler urlIdHandler) {
super(service, urlIdHandler);
}

View File

@ -1,18 +1,18 @@
package org.schabi.newpipe.extractor.services.soundcloud;
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.utils.Parser;
import org.schabi.newpipe.extractor.utils.Utils;
import java.util.List;
public class SoundcloudPlaylistUIHFactory extends ListUIHFactory {
private static final SoundcloudPlaylistUIHFactory instance = new SoundcloudPlaylistUIHFactory();
public class SoundcloudPlaylistLinkHandlerFactory extends ListLinkHandlerFactory {
private static final SoundcloudPlaylistLinkHandlerFactory instance = new SoundcloudPlaylistLinkHandlerFactory();
private final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+" +
"/sets/[0-9a-z_-]+/?([#?].*)?$";
public static SoundcloudPlaylistUIHFactory getInstance() {
public static SoundcloudPlaylistLinkHandlerFactory getInstance() {
return instance;
}

View File

@ -9,7 +9,7 @@ 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.SearchExtractor;
import org.schabi.newpipe.extractor.uih.SearchQIHandler;
import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandler;
import org.schabi.newpipe.extractor.utils.Parser;
import javax.annotation.Nonnull;
@ -18,14 +18,14 @@ import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import static org.schabi.newpipe.extractor.services.soundcloud.SoundcloudSearchQIHFactory.ITEMS_PER_PAGE;
import static org.schabi.newpipe.extractor.services.soundcloud.SoundcloudSearchQueryHandlerFactory.ITEMS_PER_PAGE;
public class SoundcloudSearchExtractor extends SearchExtractor {
private JsonArray searchCollection;
public SoundcloudSearchExtractor(StreamingService service,
SearchQIHandler urlIdHandler,
SearchQueryHandler urlIdHandler,
String contentCountry) {
super(service, urlIdHandler, contentCountry);
}

View File

@ -2,14 +2,14 @@ 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.uih.SearchQIHFactory;
import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandlerFactory;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;
public class SoundcloudSearchQIHFactory extends SearchQIHFactory {
public class SoundcloudSearchQueryHandlerFactory extends SearchQueryHandlerFactory {
public static final String CHARSET_UTF_8 = "UTF-8";
public static final String TRACKS = "tracks";
@ -58,9 +58,9 @@ public class SoundcloudSearchQIHFactory extends SearchQIHFactory {
@Override
public String[] getAvailableContentFilter() {
return new String[] {
TRACKS,
USERS,
PLAYLIST,
ANY};
ANY,
TRACKS,
USERS,
PLAYLIST};
}
}

View File

@ -1,7 +1,7 @@
package org.schabi.newpipe.extractor.services.soundcloud;
import org.schabi.newpipe.extractor.*;
import org.schabi.newpipe.extractor.uih.*;
import org.schabi.newpipe.extractor.linkhandler.*;
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.kiosk.KioskExtractor;
@ -21,43 +21,43 @@ public class SoundcloudService extends StreamingService {
}
@Override
public SearchExtractor getSearchExtractor(SearchQIHandler queryHandler, String contentCountry) {
public SearchExtractor getSearchExtractor(SearchQueryHandler queryHandler, String contentCountry) {
return new SoundcloudSearchExtractor(this, queryHandler, contentCountry);
}
@Override
public SearchQIHFactory getSearchQIHFactory() {
return new SoundcloudSearchQIHFactory();
public SearchQueryHandlerFactory getSearchQIHFactory() {
return new SoundcloudSearchQueryHandlerFactory();
}
@Override
public UIHFactory getStreamUIHFactory() {
return SoundcloudStreamUIHFactory.getInstance();
public LinkHandlerFactory getStreamUIHFactory() {
return SoundcloudStreamLinkHandlerFactory.getInstance();
}
@Override
public ListUIHFactory getChannelUIHFactory() {
return SoundcloudChannelUIHFactory.getInstance();
public ListLinkHandlerFactory getChannelUIHFactory() {
return SoundcloudChannelLinkHandlerFactory.getInstance();
}
@Override
public ListUIHFactory getPlaylistUIHFactory() {
return SoundcloudPlaylistUIHFactory.getInstance();
public ListLinkHandlerFactory getPlaylistUIHFactory() {
return SoundcloudPlaylistLinkHandlerFactory.getInstance();
}
@Override
public StreamExtractor getStreamExtractor(UIHandler UIHandler) {
return new SoundcloudStreamExtractor(this, UIHandler);
public StreamExtractor getStreamExtractor(LinkHandler LinkHandler) {
return new SoundcloudStreamExtractor(this, LinkHandler);
}
@Override
public ChannelExtractor getChannelExtractor(ListUIHandler urlIdHandler) {
public ChannelExtractor getChannelExtractor(ListLinkHandler urlIdHandler) {
return new SoundcloudChannelExtractor(this, urlIdHandler);
}
@Override
public PlaylistExtractor getPlaylistExtractor(ListUIHandler urlIdHandler) {
public PlaylistExtractor getPlaylistExtractor(ListLinkHandler urlIdHandler) {
return new SoundcloudPlaylistExtractor(this, urlIdHandler);
}
@ -75,14 +75,14 @@ public class SoundcloudService extends StreamingService {
String id)
throws ExtractionException {
return new SoundcloudChartsExtractor(SoundcloudService.this,
new SoundcloudChartsUIHFactory().fromUrl(url), id);
new SoundcloudChartsLinkHandlerFactory().fromUrl(url), id);
}
};
KioskList list = new KioskList(getServiceId());
// add kiosks here e.g.:
final SoundcloudChartsUIHFactory h = new SoundcloudChartsUIHFactory();
final SoundcloudChartsLinkHandlerFactory h = new SoundcloudChartsLinkHandlerFactory();
try {
list.addKioskEntry(chartsFactory, h, "Top 50");
list.addKioskEntry(chartsFactory, h, "New & hot");

View File

@ -7,8 +7,8 @@ import org.schabi.newpipe.extractor.*;
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.linkhandler.LinkHandler;
import org.schabi.newpipe.extractor.stream.*;
import org.schabi.newpipe.extractor.uih.UIHandler;
import javax.annotation.Nonnull;
import java.io.IOException;
@ -21,7 +21,7 @@ import java.util.List;
public class SoundcloudStreamExtractor extends StreamExtractor {
private JsonObject track;
public SoundcloudStreamExtractor(StreamingService service, UIHandler uIHandler) {
public SoundcloudStreamExtractor(StreamingService service, LinkHandler uIHandler) {
super(service, uIHandler);
}
@ -202,16 +202,6 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
return collector;
}
@Override
public String[] getDonationLinks() {
return new String[0];
}
@Override
public String[] getAffiliateLinks() {
return new String[0];
}
@Override
public String getErrorMessage() {
return null;

View File

@ -1,19 +1,19 @@
package org.schabi.newpipe.extractor.services.soundcloud;
import org.schabi.newpipe.extractor.uih.UIHFactory;
import org.schabi.newpipe.extractor.linkhandler.LinkHandlerFactory;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.utils.Parser;
import org.schabi.newpipe.extractor.utils.Utils;
public class SoundcloudStreamUIHFactory extends UIHFactory {
private static final SoundcloudStreamUIHFactory instance = new SoundcloudStreamUIHFactory();
public class SoundcloudStreamLinkHandlerFactory extends LinkHandlerFactory {
private static final SoundcloudStreamLinkHandlerFactory instance = new SoundcloudStreamLinkHandlerFactory();
private final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+" +
"/(?!(tracks|albums|sets|reposts|followers|following)/?$)[0-9a-z_-]+/?([#?].*)?$";
private SoundcloudStreamUIHFactory() {
private SoundcloudStreamLinkHandlerFactory() {
}
public static SoundcloudStreamUIHFactory getInstance() {
public static SoundcloudStreamLinkHandlerFactory getInstance() {
return instance;
}

View File

@ -1,7 +1,7 @@
package org.schabi.newpipe.extractor.services.youtube;
import org.schabi.newpipe.extractor.*;
import org.schabi.newpipe.extractor.uih.*;
import org.schabi.newpipe.extractor.linkhandler.*;
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.kiosk.KioskExtractor;
@ -9,7 +9,7 @@ import org.schabi.newpipe.extractor.kiosk.KioskList;
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
import org.schabi.newpipe.extractor.search.SearchExtractor;
import org.schabi.newpipe.extractor.services.youtube.extractors.*;
import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.*;
import org.schabi.newpipe.extractor.services.youtube.linkHandler.*;
import org.schabi.newpipe.extractor.stream.StreamExtractor;
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
@ -44,42 +44,42 @@ public class YoutubeService extends StreamingService {
}
@Override
public SearchExtractor getSearchExtractor(SearchQIHandler query, String contentCountry) {
public SearchExtractor getSearchExtractor(SearchQueryHandler query, String contentCountry) {
return new YoutubeSearchExtractor(this, query, contentCountry);
}
@Override
public UIHFactory getStreamUIHFactory() {
return YoutubeStreamUIHFactory.getInstance();
public LinkHandlerFactory getStreamUIHFactory() {
return YoutubeStreamLinkHandlerFactory.getInstance();
}
@Override
public ListUIHFactory getChannelUIHFactory() {
return YoutubeChannelUIHFactory.getInstance();
public ListLinkHandlerFactory getChannelUIHFactory() {
return YoutubeChannelLinkHandlerFactory.getInstance();
}
@Override
public ListUIHFactory getPlaylistUIHFactory() {
return YoutubePlaylistUIHFactory.getInstance();
public ListLinkHandlerFactory getPlaylistUIHFactory() {
return YoutubePlaylistLinkHandlerFactory.getInstance();
}
@Override
public SearchQIHFactory getSearchQIHFactory() {
return YoutubeSearchQIHFactory.getInstance();
public SearchQueryHandlerFactory getSearchQIHFactory() {
return YoutubeSearchQueryHandlerFactory.getInstance();
}
@Override
public StreamExtractor getStreamExtractor(UIHandler uiHandler) throws ExtractionException {
return new YoutubeStreamExtractor(this, uiHandler);
public StreamExtractor getStreamExtractor(LinkHandler linkHandler) throws ExtractionException {
return new YoutubeStreamExtractor(this, linkHandler);
}
@Override
public ChannelExtractor getChannelExtractor(ListUIHandler urlIdHandler) throws ExtractionException {
public ChannelExtractor getChannelExtractor(ListLinkHandler urlIdHandler) throws ExtractionException {
return new YoutubeChannelExtractor(this, urlIdHandler);
}
@Override
public PlaylistExtractor getPlaylistExtractor(ListUIHandler urlIdHandler) throws ExtractionException {
public PlaylistExtractor getPlaylistExtractor(ListLinkHandler urlIdHandler) throws ExtractionException {
return new YoutubePlaylistExtractor(this, urlIdHandler);
}
@ -99,9 +99,9 @@ public class YoutubeService extends StreamingService {
public KioskExtractor createNewKiosk(StreamingService streamingService, String url, String id)
throws ExtractionException {
return new YoutubeTrendingExtractor(YoutubeService.this,
new YoutubeTrendingUIHFactory().fromUrl(url), id);
new YoutubeTrendingLinkHandlerFactory().fromUrl(url), id);
}
}, new YoutubeTrendingUIHFactory(), "Trending");
}, new YoutubeTrendingLinkHandlerFactory(), "Trending");
list.setDefaultKiosk("Trending");
} catch (Exception e) {
throw new ExtractionException(e);

View File

@ -13,8 +13,7 @@ import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
import org.schabi.newpipe.extractor.uih.ListUIHandler;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import org.schabi.newpipe.extractor.utils.DonationLinkHelper;
import org.schabi.newpipe.extractor.utils.Parser;
import org.schabi.newpipe.extractor.utils.Utils;
@ -50,7 +49,7 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
private Document doc;
public YoutubeChannelExtractor(StreamingService service, ListUIHandler urlIdHandler) {
public YoutubeChannelExtractor(StreamingService service, ListLinkHandler urlIdHandler) {
super(service, urlIdHandler);
}

View File

@ -9,12 +9,13 @@ import org.jsoup.nodes.Element;
import org.schabi.newpipe.extractor.*;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.linkhandler.LinkHandlerFactory;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeParsingHelper;
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeParsingHelper;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
import org.schabi.newpipe.extractor.stream.StreamType;
import org.schabi.newpipe.extractor.uih.ListUIHandler;
import org.schabi.newpipe.extractor.utils.Utils;
import javax.annotation.Nonnull;
@ -25,7 +26,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
private Document doc;
public YoutubePlaylistExtractor(StreamingService service, ListUIHandler urlIdHandler) throws ExtractionException {
public YoutubePlaylistExtractor(StreamingService service, ListLinkHandler urlIdHandler) throws ExtractionException {
super(service, urlIdHandler);
}
@ -174,7 +175,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
private void collectStreamsFrom(StreamInfoItemsCollector collector, Element element) {
collector.reset();
final org.schabi.newpipe.extractor.uih.UIHFactory streamUIHFactory = getService().getStreamUIHFactory();
final LinkHandlerFactory streamLinkHandlerFactory = getService().getStreamUIHFactory();
for (final Element li : element.children()) {
if(isDeletedItem(li)) {
continue;
@ -191,7 +192,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
@Override
public String getUrl() throws ParsingException {
try {
return streamUIHFactory.fromId(li.attr("data-video-id")).getUrl();
return streamLinkHandlerFactory.fromId(li.attr("data-video-id")).getUrl();
} catch (Exception e) {
throw new ParsingException("Could not get web page url for the video", e);
}
@ -256,7 +257,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
@Override
public String getThumbnailUrl() throws ParsingException {
try {
return "https://i.ytimg.com/vi/" + streamUIHFactory.fromUrl(getUrl()).getId() + "/hqdefault.jpg";
return "https://i.ytimg.com/vi/" + streamLinkHandlerFactory.fromUrl(getUrl()).getId() + "/hqdefault.jpg";
} catch (Exception e) {
throw new ParsingException("Could not get thumbnail url", e);
}

View File

@ -10,7 +10,7 @@ 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.SearchExtractor;
import org.schabi.newpipe.extractor.uih.SearchQIHandler;
import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandler;
import org.schabi.newpipe.extractor.utils.Parser;
import javax.annotation.Nonnull;
@ -44,7 +44,7 @@ public class YoutubeSearchExtractor extends SearchExtractor {
private Document doc;
public YoutubeSearchExtractor(StreamingService service,
SearchQIHandler urlIdHandler,
SearchQueryHandler urlIdHandler,
String contentCountry) {
super(service, urlIdHandler, contentCountry);
}

View File

@ -15,9 +15,9 @@ import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
import org.schabi.newpipe.extractor.linkhandler.LinkHandler;
import org.schabi.newpipe.extractor.services.youtube.ItagItem;
import org.schabi.newpipe.extractor.stream.*;
import org.schabi.newpipe.extractor.uih.UIHandler;
import org.schabi.newpipe.extractor.utils.DonationLinkHelper;
import org.schabi.newpipe.extractor.utils.Parser;
import org.schabi.newpipe.extractor.utils.Utils;
@ -85,8 +85,8 @@ public class YoutubeStreamExtractor extends StreamExtractor {
private boolean isAgeRestricted;
public YoutubeStreamExtractor(StreamingService service, UIHandler uiHandler) throws ExtractionException {
super(service, uiHandler);
public YoutubeStreamExtractor(StreamingService service, LinkHandler linkHandler) {
super(service, linkHandler);
}
/*//////////////////////////////////////////////////////////////////////////
@ -518,41 +518,6 @@ public class YoutubeStreamExtractor extends StreamExtractor {
return errorReason != null ? errorReason.toString() : null;
}
@Override
public String[] getDonationLinks() throws ParsingException {
try {
ArrayList<String> donationLinks = new ArrayList<>();
for (String s : Parser.getLinksFromString(getDescription())) {
if (DonationLinkHelper.getDonatoinServiceByLink(s) != DonationLinkHelper.DonationService.NO_DONATION) {
donationLinks.add(s);
}
}
String[] donlret = new String[donationLinks.size()];
donlret = donationLinks.toArray(donlret);
return donlret;
} catch (Exception e) {
throw new ParsingException("Could not get donation links", e);
}
}
@Override
public String[] getAffiliateLinks() throws ParsingException {
try {
ArrayList<String> donationLinks = new ArrayList<>();
for (String s : Parser.getLinksFromString(getDescription())) {
if (DonationLinkHelper.getAffiliateServiceByLink(s) != DonationLinkHelper.AffiliateService.NO_AFILIATE) {
donationLinks.add(s);
}
}
String[] donlret = new String[donationLinks.size()];
donlret = donationLinks.toArray(donlret);
return donlret;
} catch (Exception e) {
throw new ParsingException("Could not get afiliate links", e);
}
}
/*//////////////////////////////////////////////////////////////////////////
// Fetch page
//////////////////////////////////////////////////////////////////////////*/

View File

@ -2,7 +2,7 @@ package org.schabi.newpipe.extractor.services.youtube.extractors;
import org.jsoup.nodes.Element;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeParsingHelper;
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeParsingHelper;
import org.schabi.newpipe.extractor.stream.StreamInfoItemExtractor;
import org.schabi.newpipe.extractor.stream.StreamType;
import org.schabi.newpipe.extractor.utils.Utils;

View File

@ -25,7 +25,7 @@ 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.uih.ListUIHandler;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
@ -41,7 +41,7 @@ public class YoutubeTrendingExtractor extends KioskExtractor {
private Document doc;
public YoutubeTrendingExtractor(StreamingService service,
ListUIHandler urlIdHandler,
ListLinkHandler urlIdHandler,
String kioskId) {
super(service, urlIdHandler, kioskId);
}

View File

@ -1,6 +1,6 @@
package org.schabi.newpipe.extractor.services.youtube.urlIdHandlers;
package org.schabi.newpipe.extractor.services.youtube.linkHandler;
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.utils.Parser;
@ -10,7 +10,7 @@ import java.util.List;
* Created by Christian Schabesberger on 25.07.16.
*
* Copyright (C) Christian Schabesberger 2018 <chrźis.schabesberger@mailbox.org>
* YoutubeChannelUIHFactory.java is part of NewPipe.
* YoutubeChannelLinkHandlerFactory.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
@ -26,12 +26,12 @@ import java.util.List;
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class YoutubeChannelUIHFactory extends ListUIHFactory {
public class YoutubeChannelLinkHandlerFactory extends ListLinkHandlerFactory {
private static final YoutubeChannelUIHFactory instance = new YoutubeChannelUIHFactory();
private static final YoutubeChannelLinkHandlerFactory instance = new YoutubeChannelLinkHandlerFactory();
private static final String ID_PATTERN = "/(user/[A-Za-z0-9_-]*|channel/[A-Za-z0-9_-]*)";
public static YoutubeChannelUIHFactory getInstance() {
public static YoutubeChannelLinkHandlerFactory getInstance() {
return instance;
}

View File

@ -1,4 +1,4 @@
package org.schabi.newpipe.extractor.services.youtube.urlIdHandlers;
package org.schabi.newpipe.extractor.services.youtube.linkHandler;
import org.schabi.newpipe.extractor.exceptions.ParsingException;

View File

@ -1,18 +1,18 @@
package org.schabi.newpipe.extractor.services.youtube.urlIdHandlers;
package org.schabi.newpipe.extractor.services.youtube.linkHandler;
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.utils.Parser;
import java.util.List;
public class YoutubePlaylistUIHFactory extends ListUIHFactory {
public class YoutubePlaylistLinkHandlerFactory extends ListLinkHandlerFactory {
private static final YoutubePlaylistUIHFactory instance = new YoutubePlaylistUIHFactory();
private static final YoutubePlaylistLinkHandlerFactory instance = new YoutubePlaylistLinkHandlerFactory();
private static final String ID_PATTERN = "([\\-a-zA-Z0-9_]{10,})";
public static YoutubePlaylistUIHFactory getInstance() {
public static YoutubePlaylistLinkHandlerFactory getInstance() {
return instance;
}

View File

@ -1,13 +1,13 @@
package org.schabi.newpipe.extractor.services.youtube.urlIdHandlers;
package org.schabi.newpipe.extractor.services.youtube.linkHandler;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.uih.SearchQIHFactory;
import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandlerFactory;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;
public class YoutubeSearchQIHFactory extends SearchQIHFactory {
public class YoutubeSearchQueryHandlerFactory extends SearchQueryHandlerFactory {
public static final String CHARSET_UTF_8 = "UTF-8";
@ -16,8 +16,8 @@ public class YoutubeSearchQIHFactory extends SearchQIHFactory {
public static final String PLAYLIST = "playlist";
public static final String ANY = "any";
public static YoutubeSearchQIHFactory getInstance() {
return new YoutubeSearchQIHFactory();
public static YoutubeSearchQueryHandlerFactory getInstance() {
return new YoutubeSearchQueryHandlerFactory();
}
@Override
@ -45,9 +45,9 @@ public class YoutubeSearchQIHFactory extends SearchQIHFactory {
@Override
public String[] getAvailableContentFilter() {
return new String[] {
ANY,
STREAM,
CHANNEL,
PLAYLIST,
ANY};
PLAYLIST};
}
}

View File

@ -1,11 +1,11 @@
package org.schabi.newpipe.extractor.services.youtube.urlIdHandlers;
package org.schabi.newpipe.extractor.services.youtube.linkHandler;
import org.jsoup.Jsoup;
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.uih.UIHFactory;
import org.schabi.newpipe.extractor.linkhandler.LinkHandlerFactory;
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 2018 <chris.schabesberger@mailbox.org>
* YoutubeStreamUIHFactory.java is part of NewPipe.
* YoutubeStreamLinkHandlerFactory.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 <http://www.gnu.org/licenses/>.
*/
public class YoutubeStreamUIHFactory extends UIHFactory {
public class YoutubeStreamLinkHandlerFactory extends LinkHandlerFactory {
private static final YoutubeStreamUIHFactory instance = new YoutubeStreamUIHFactory();
private static final YoutubeStreamLinkHandlerFactory instance = new YoutubeStreamLinkHandlerFactory();
private static final String ID_PATTERN = "([\\-a-zA-Z0-9_]{11})";
private YoutubeStreamUIHFactory() {
private YoutubeStreamLinkHandlerFactory() {
}
public static YoutubeStreamUIHFactory getInstance() {
public static YoutubeStreamLinkHandlerFactory getInstance() {
return instance;
}

View File

@ -1,10 +1,10 @@
package org.schabi.newpipe.extractor.services.youtube.urlIdHandlers;
package org.schabi.newpipe.extractor.services.youtube.linkHandler;
/*
* Created by Christian Schabesberger on 12.08.17.
*
* Copyright (C) Christian Schabesberger 2018 <chris.schabesberger@mailbox.org>
* YoutubeTrendingUIHFactory.java is part of NewPipe.
* YoutubeTrendingLinkHandlerFactory.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,12 @@ package org.schabi.newpipe.extractor.services.youtube.urlIdHandlers;
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
import org.schabi.newpipe.extractor.utils.Parser;
import java.util.List;
public class YoutubeTrendingUIHFactory extends ListUIHFactory {
public class YoutubeTrendingLinkHandlerFactory extends ListLinkHandlerFactory {
public String getUrl(String id, List<String> contentFilters, String sortFilter) {
return "https://www.youtube.com/feed/trending";

View File

@ -23,10 +23,9 @@ 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.uih.UIHFactory;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.uih.UIHandler;
import org.schabi.newpipe.extractor.linkhandler.LinkHandler;
import org.schabi.newpipe.extractor.utils.Parser;
import javax.annotation.Nonnull;
@ -40,8 +39,8 @@ public abstract class StreamExtractor extends Extractor {
public static final int NO_AGE_LIMIT = 0;
public StreamExtractor(StreamingService service, UIHandler uiHandler) {
super(service, uiHandler);
public StreamExtractor(StreamingService service, LinkHandler linkHandler) {
super(service, linkHandler);
}
@Nonnull
@ -136,9 +135,6 @@ public abstract class StreamExtractor extends Extractor {
public abstract StreamInfoItem getNextVideo() throws IOException, ExtractionException;
public abstract StreamInfoItemsCollector getRelatedVideos() throws IOException, ExtractionException;
public abstract String[] getDonationLinks() throws ExtractionException;
public abstract String[] getAffiliateLinks() throws ExtractionException;
/**
* Analyses the webpage's document and extracts any error message there might be.
*

View File

@ -242,16 +242,6 @@ public class StreamInfo extends Info {
} catch (Exception e) {
streamInfo.addError(e);
}
try {
streamInfo.setAffiliateLinks(extractor.getAffiliateLinks());
} catch (Exception e) {
streamInfo.addError(e);
}
try {
streamInfo.setDonationLinks(extractor.getDonationLinks());
} catch (Exception e) {
streamInfo.addError(e);
}
streamInfo.setRelatedStreams(ExtractorHelper.getRelatedVideosOrLogError(streamInfo, extractor));
return streamInfo;
@ -284,9 +274,6 @@ public class StreamInfo extends Info {
private long startPosition = 0;
private List<Subtitles> subtitles;
private String[] donationLinks;
private String[] affiliateLinks;
/**
* Get the stream type
*
@ -480,19 +467,4 @@ public class StreamInfo extends Info {
this.subtitles = subtitles;
}
public String[] getDonationLinks() {
return donationLinks;
}
public void setDonationLinks(String[] donationLinks) {
this.donationLinks = donationLinks;
}
public String[] getAffiliateLinks() {
return affiliateLinks;
}
public void setAffiliateLinks(String[] affiliateLinks) {
this.affiliateLinks = affiliateLinks;
}
}

View File

@ -15,7 +15,7 @@ import static org.junit.Assert.*;
import static org.schabi.newpipe.extractor.ServiceList.SoundCloud;
/**
* Test for {@link SoundcloudChartsUIHFactory}
* Test for {@link SoundcloudChartsLinkHandlerFactory}
*/
public class SoundcloudChartsExtractorTest {

View File

@ -11,14 +11,14 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* Test for {@link SoundcloudChartsUIHFactory}
* Test for {@link SoundcloudChartsLinkHandlerFactory}
*/
public class SoundcloudChartsUIHFactoryTest {
private static SoundcloudChartsUIHFactory urlIdHandler;
public class SoundcloudChartsLinkHandlerFactoryTest {
private static SoundcloudChartsLinkHandlerFactory urlIdHandler;
@BeforeClass
public static void setUp() throws Exception {
urlIdHandler = new SoundcloudChartsUIHFactory();
urlIdHandler = new SoundcloudChartsLinkHandlerFactory();
NewPipe.init(Downloader.getInstance());
}

View File

@ -12,14 +12,14 @@ import java.util.List;
import static org.junit.Assert.*;
/**
* Test for {@link SoundcloudStreamUIHFactory}
* Test for {@link SoundcloudStreamLinkHandlerFactory}
*/
public class SoundcloudStreamUIHFactoryTest {
private static SoundcloudStreamUIHFactory urlIdHandler;
public class SoundcloudStreamLinkHandlerFactoryTest {
private static SoundcloudStreamLinkHandlerFactory urlIdHandler;
@BeforeClass
public static void setUp() throws Exception {
urlIdHandler = SoundcloudStreamUIHFactory.getInstance();
urlIdHandler = SoundcloudStreamLinkHandlerFactory.getInstance();
NewPipe.init(Downloader.getInstance());
}

View File

@ -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.uih.UIHFactory;
import org.schabi.newpipe.extractor.linkhandler.LinkHandlerFactory;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
import org.schabi.newpipe.extractor.subscription.SubscriptionItem;
@ -21,7 +21,7 @@ import static org.junit.Assert.*;
*/
public class SoundcloudSubscriptionExtractorTest {
private static SoundcloudSubscriptionExtractor subscriptionExtractor;
private static UIHFactory urlHandler;
private static LinkHandlerFactory urlHandler;
@BeforeClass
public static void setupClass() {

View File

@ -4,23 +4,22 @@ import org.junit.BeforeClass;
import org.junit.Test;
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.YoutubeChannelUIHFactory;
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeChannelLinkHandlerFactory;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* Test for {@link YoutubeChannelUIHFactory}
* Test for {@link YoutubeChannelLinkHandlerFactory}
*/
public class YoutubeChannelUIHFactoryTest {
public class YoutubeChannelLinkHandlerFactoryTest {
private static YoutubeChannelUIHFactory urlIdHandler;
private static YoutubeChannelLinkHandlerFactory urlIdHandler;
@BeforeClass
public static void setUp() {
urlIdHandler = YoutubeChannelUIHFactory.getInstance();
urlIdHandler = YoutubeChannelLinkHandlerFactory.getInstance();
NewPipe.init(Downloader.getInstance());
}

View File

@ -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.YoutubeStreamUIHFactory;
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeStreamLinkHandlerFactory;
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 YoutubeStreamUIHFactory}
* Test for {@link YoutubeStreamLinkHandlerFactory}
*/
public class YoutubeStreamExtractorControversialTest {
private static YoutubeStreamExtractor extractor;

View File

@ -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.YoutubeStreamUIHFactory;
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeStreamLinkHandlerFactory;
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 YoutubeStreamUIHFactory}
* Test for {@link YoutubeStreamLinkHandlerFactory}
*/
public class YoutubeStreamExtractorRestrictedTest {
public static final String HTTPS = "https://";

View File

@ -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.YoutubeStreamUIHFactory;
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeStreamLinkHandlerFactory;
import java.util.ArrayList;
import java.util.List;
@ -14,15 +14,15 @@ import java.util.List;
import static org.junit.Assert.*;
/**
* Test for {@link YoutubeStreamUIHFactory}
* Test for {@link YoutubeStreamLinkHandlerFactory}
*/
public class YoutubeStreamUIHFactoryTest {
public class YoutubeStreamLinkHandlerFactoryTest {
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 YoutubeStreamUIHFactory urlIdHandler;
private static YoutubeStreamLinkHandlerFactory urlIdHandler;
@BeforeClass
public static void setUp() {
urlIdHandler = YoutubeStreamUIHFactory.getInstance();
urlIdHandler = YoutubeStreamLinkHandlerFactory.getInstance();
NewPipe.init(Downloader.getInstance());
}

View File

@ -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.uih.UIHFactory;
import org.schabi.newpipe.extractor.linkhandler.LinkHandlerFactory;
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeSubscriptionExtractor;
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
import org.schabi.newpipe.extractor.subscription.SubscriptionItem;
@ -23,7 +23,7 @@ import static org.junit.Assert.*;
*/
public class YoutubeSubscriptionExtractorTest {
private static YoutubeSubscriptionExtractor subscriptionExtractor;
private static UIHFactory urlHandler;
private static LinkHandlerFactory urlHandler;
@BeforeClass
public static void setupClass() {

View File

@ -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.YoutubeTrendingUIHFactory;
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeTrendingLinkHandlerFactory;
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 YoutubeTrendingUIHFactory}
* Test for {@link YoutubeTrendingLinkHandlerFactory}
*/
public class YoutubeTrendingExtractorTest {

View File

@ -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.uih.UIHFactory;
import org.schabi.newpipe.extractor.linkhandler.LinkHandlerFactory;
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;
UIHFactory UIHFactory = service.getKioskList().getUIHFactoryByType("Trending");
LinkHandlerFactory LinkHandlerFactory = service.getKioskList().getUIHFactoryByType("Trending");
kioskInfo = KioskInfo.getInfo(YouTube, UIHFactory.fromId("Trending").getUrl(), null);
kioskInfo = KioskInfo.getInfo(YouTube, LinkHandlerFactory.fromId("Trending").getUrl(), null);
}
@Test

View File

@ -0,0 +1,83 @@
package org.schabi.newpipe.extractor.services.youtube;
/*
* Created by Christian Schabesberger on 12.08.17.
*
* Copyright (C) Christian Schabesberger 2017 <chris.schabesberger@mailbox.org>
* YoutubeTrendingLinkHandlerFactoryTest.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 <http://www.gnu.org/licenses/>.
*/
import org.junit.BeforeClass;
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.linkhandler.LinkHandlerFactory;
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeTrendingLinkHandlerFactory;
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 YoutubeTrendingLinkHandlerFactory}
*/
public class YoutubeTrendingLinkHandlerFactoryTest {
private static LinkHandlerFactory LinkHandlerFactory;
@BeforeClass
public static void setUp() throws Exception {
LinkHandlerFactory = YouTube.getKioskList().getUIHFactoryByType("Trending");
NewPipe.init(Downloader.getInstance());
}
@Test
public void getUrl()
throws Exception {
assertEquals(LinkHandlerFactory.fromId("").getUrl(), "https://www.youtube.com/feed/trending");
}
@Test
public void getId()
throws Exception {
assertEquals(LinkHandlerFactory.fromUrl("https://www.youtube.com/feed/trending").getId(), "Trending");
}
@Test
public void acceptUrl() throws ParsingException {
assertTrue(LinkHandlerFactory.acceptUrl("https://www.youtube.com/feed/trending"));
assertTrue(LinkHandlerFactory.acceptUrl("https://www.youtube.com/feed/trending?adsf=fjaj#fhe"));
assertTrue(LinkHandlerFactory.acceptUrl("http://www.youtube.com/feed/trending"));
assertTrue(LinkHandlerFactory.acceptUrl("www.youtube.com/feed/trending"));
assertTrue(LinkHandlerFactory.acceptUrl("youtube.com/feed/trending"));
assertTrue(LinkHandlerFactory.acceptUrl("youtube.com/feed/trending?akdsakjf=dfije&kfj=dkjak"));
assertTrue(LinkHandlerFactory.acceptUrl("https://youtube.com/feed/trending"));
assertTrue(LinkHandlerFactory.acceptUrl("m.youtube.com/feed/trending"));
assertFalse(LinkHandlerFactory.acceptUrl("https://youtu.be/feed/trending"));
assertFalse(LinkHandlerFactory.acceptUrl("kdskjfiiejfia"));
assertFalse(LinkHandlerFactory.acceptUrl("https://www.youtube.com/bullshit/feed/trending"));
assertFalse(LinkHandlerFactory.acceptUrl("https://www.youtube.com/feed/trending/bullshit"));
assertFalse(LinkHandlerFactory.acceptUrl("https://www.youtube.com/feed/bullshit/trending"));
assertFalse(LinkHandlerFactory.acceptUrl("peter klaut aepferl youtube.com/feed/trending"));
assertFalse(LinkHandlerFactory.acceptUrl("youtube.com/feed/trending askjkf"));
assertFalse(LinkHandlerFactory.acceptUrl("askdjfi youtube.com/feed/trending askjkf"));
assertFalse(LinkHandlerFactory.acceptUrl(" youtube.com/feed/trending"));
assertFalse(LinkHandlerFactory.acceptUrl("https://www.youtube.com/feed/trending.html"));
assertFalse(LinkHandlerFactory.acceptUrl(""));
}
}

View File

@ -1,83 +0,0 @@
package org.schabi.newpipe.extractor.services.youtube;
/*
* Created by Christian Schabesberger on 12.08.17.
*
* Copyright (C) Christian Schabesberger 2017 <chris.schabesberger@mailbox.org>
* 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 <http://www.gnu.org/licenses/>.
*/
import org.junit.BeforeClass;
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.uih.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().getUIHFactoryByType("Trending");
NewPipe.init(Downloader.getInstance());
}
@Test
public void getUrl()
throws Exception {
assertEquals(UIHFactory.fromId("").getUrl(), "https://www.youtube.com/feed/trending");
}
@Test
public void getId()
throws Exception {
assertEquals(UIHFactory.fromUrl("https://www.youtube.com/feed/trending").getId(), "Trending");
}
@Test
public void acceptUrl() throws ParsingException {
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(""));
}
}