replace uiHandler name with linkhandler
This commit is contained in:
parent
1e7bcfbd66
commit
dc0d0bda24
|
@ -15,17 +15,17 @@ public abstract class Extractor {
|
|||
*/
|
||||
private final StreamingService service;
|
||||
|
||||
private final LinkHandler uIHandler;
|
||||
private final LinkHandler linkHandler;
|
||||
|
||||
@Nullable
|
||||
private boolean pageFetched = false;
|
||||
private final Downloader downloader;
|
||||
|
||||
public Extractor(final StreamingService service, final LinkHandler uIHandler) {
|
||||
public Extractor(final StreamingService service, final LinkHandler linkHandler) {
|
||||
if(service == null) throw new NullPointerException("service is null");
|
||||
if(uIHandler == null) throw new NullPointerException("LinkHandler is null");
|
||||
if(linkHandler == null) throw new NullPointerException("LinkHandler is null");
|
||||
this.service = service;
|
||||
this.uIHandler = uIHandler;
|
||||
this.linkHandler = linkHandler;
|
||||
this.downloader = NewPipe.getDownloader();
|
||||
if(downloader == null) throw new NullPointerException("downloader is null");
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ public abstract class Extractor {
|
|||
* @return The {@link LinkHandler} of the current extractor object (e.g. a ChannelExtractor should return a channel url handler).
|
||||
*/
|
||||
@Nonnull
|
||||
public LinkHandler getUIHandler() {
|
||||
return uIHandler;
|
||||
public LinkHandler getLinkHandler() {
|
||||
return linkHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -67,7 +67,7 @@ public abstract class Extractor {
|
|||
|
||||
@Nonnull
|
||||
public String getId() throws ParsingException {
|
||||
return uIHandler.getId();
|
||||
return linkHandler.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,12 +80,12 @@ public abstract class Extractor {
|
|||
|
||||
@Nonnull
|
||||
public String getOriginalUrl() throws ParsingException {
|
||||
return uIHandler.getOriginalUrl();
|
||||
return linkHandler.getOriginalUrl();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public String getUrl() throws ParsingException {
|
||||
return uIHandler.getUrl();
|
||||
return linkHandler.getUrl();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
|
|
@ -13,8 +13,8 @@ import java.util.List;
|
|||
*/
|
||||
public abstract class ListExtractor<R extends InfoItem> extends Extractor {
|
||||
|
||||
public ListExtractor(StreamingService service, ListLinkHandler uiHandler) {
|
||||
super(service, uiHandler);
|
||||
public ListExtractor(StreamingService service, ListLinkHandler linkHandler) {
|
||||
super(service, linkHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,8 +51,8 @@ public abstract class ListExtractor<R extends InfoItem> extends Extractor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ListLinkHandler getUIHandler() {
|
||||
return (ListLinkHandler) super.getUIHandler();
|
||||
public ListLinkHandler getLinkHandler() {
|
||||
return (ListLinkHandler) super.getLinkHandler();
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -55,7 +55,7 @@ public class ChannelInfo extends ListInfo<StreamInfoItem> {
|
|||
public static ChannelInfo getInfo(ChannelExtractor extractor) throws IOException, ExtractionException {
|
||||
|
||||
ChannelInfo info = new ChannelInfo(extractor.getServiceId(),
|
||||
extractor.getUIHandler(),
|
||||
extractor.getLinkHandler(),
|
||||
extractor.getName());
|
||||
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class KioskInfo extends ListInfo<StreamInfoItem> {
|
|||
public static KioskInfo getInfo(KioskExtractor extractor) throws ExtractionException {
|
||||
|
||||
final KioskInfo info = new KioskInfo(extractor.getServiceId(),
|
||||
extractor.getUIHandler(),
|
||||
extractor.getLinkHandler(),
|
||||
extractor.getName());
|
||||
|
||||
final ListExtractor.InfoItemsPage<StreamInfoItem> itemsPage = ExtractorHelper.getItemsPageOrLogError(info, extractor);
|
||||
|
|
|
@ -41,7 +41,7 @@ public class PlaylistInfo extends ListInfo<StreamInfoItem> {
|
|||
|
||||
final PlaylistInfo info = new PlaylistInfo(
|
||||
extractor.getServiceId(),
|
||||
extractor.getUIHandler(),
|
||||
extractor.getLinkHandler(),
|
||||
extractor.getName());
|
||||
|
||||
try {
|
||||
|
|
|
@ -25,7 +25,7 @@ public abstract class SearchExtractor extends ListExtractor<InfoItem> {
|
|||
}
|
||||
|
||||
public String getSearchString() {
|
||||
return getUIHandler().getSearchString();
|
||||
return getLinkHandler().getSearchString();
|
||||
}
|
||||
|
||||
public abstract String getSearchSuggestion() throws ParsingException;
|
||||
|
@ -35,13 +35,13 @@ public abstract class SearchExtractor extends ListExtractor<InfoItem> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SearchQueryHandler getUIHandler() {
|
||||
return (SearchQueryHandler) super.getUIHandler();
|
||||
public SearchQueryHandler getLinkHandler() {
|
||||
return (SearchQueryHandler) super.getLinkHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getUIHandler().getSearchString();
|
||||
return getLinkHandler().getSearchString();
|
||||
}
|
||||
|
||||
protected String getContentCountry() {
|
||||
|
|
|
@ -33,7 +33,7 @@ public class SearchInfo extends ListInfo<InfoItem> {
|
|||
public static SearchInfo getInfo(SearchExtractor extractor) throws ExtractionException, IOException {
|
||||
final SearchInfo info = new SearchInfo(
|
||||
extractor.getServiceId(),
|
||||
extractor.getUIHandler(),
|
||||
extractor.getLinkHandler(),
|
||||
extractor.getSearchString());
|
||||
|
||||
try {
|
||||
|
|
|
@ -31,7 +31,7 @@ public class SoundcloudChannelExtractor extends ChannelExtractor {
|
|||
@Override
|
||||
public void onFetchPage(@Nonnull Downloader downloader) throws IOException, ExtractionException {
|
||||
|
||||
userId = getUIHandler().getId();
|
||||
userId = getLinkHandler().getId();
|
||||
String apiUrl = "https://api-v2.soundcloud.com/users/" + userId +
|
||||
"?client_id=" + SoundcloudParsingHelper.clientId();
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public class SoundcloudPlaylistExtractor extends PlaylistExtractor {
|
|||
@Override
|
||||
public void onFetchPage(@Nonnull Downloader downloader) throws IOException, ExtractionException {
|
||||
|
||||
playlistId = getUIHandler().getId();
|
||||
playlistId = getLinkHandler().getId();
|
||||
String apiUrl = "https://api.soundcloud.com/playlists/" + playlistId +
|
||||
"?client_id=" + SoundcloudParsingHelper.clientId() +
|
||||
"&representation=compact";
|
||||
|
|
|
@ -21,8 +21,8 @@ import java.util.List;
|
|||
public class SoundcloudStreamExtractor extends StreamExtractor {
|
||||
private JsonObject track;
|
||||
|
||||
public SoundcloudStreamExtractor(StreamingService service, LinkHandler uIHandler) {
|
||||
super(service, uIHandler);
|
||||
public SoundcloudStreamExtractor(StreamingService service, LinkHandler linkHandler) {
|
||||
super(service, linkHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package org.schabi.newpipe.extractor.utils;
|
||||
|
||||
public class Localization {
|
||||
private final String country;
|
||||
private final String language;
|
||||
|
||||
public Localization(String country, String language) {
|
||||
this.country = country;
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
}
|
|
@ -3,7 +3,6 @@ package org.schabi.newpipe.extractor.services.youtube.search;
|
|||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.schabi.newpipe.Downloader;
|
||||
import org.schabi.newpipe.extractor.InfoItem;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
|
||||
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeSearchExtractor;
|
||||
|
@ -25,8 +24,7 @@ public class YoutubeSearchCountTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testViewCount() throws Exception {
|
||||
boolean foundKnownChannel = false;
|
||||
public void testViewCount() {
|
||||
ChannelInfoItem ci = (ChannelInfoItem) itemsPage.getItems().get(0);
|
||||
assertTrue("Count does not fit: " + Long.toString(ci.getSubscriberCount()),
|
||||
65043316 < ci.getSubscriberCount() && ci.getSubscriberCount() < 68043316);
|
||||
|
|
Loading…
Reference in New Issue