mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-26 23:10:34 +05:30
getUIHandler() to getUIHFactory()
handler to handlerFactory in kiosk
This commit is contained in:
parent
bd5423fe2a
commit
291de18418
@ -25,10 +25,10 @@ public class KioskList {
|
|||||||
private class KioskEntry {
|
private class KioskEntry {
|
||||||
public KioskEntry(KioskExtractorFactory ef, UIHFactory h) {
|
public KioskEntry(KioskExtractorFactory ef, UIHFactory h) {
|
||||||
extractorFactory = ef;
|
extractorFactory = ef;
|
||||||
handler = h;
|
handlerFactory = h;
|
||||||
}
|
}
|
||||||
final KioskExtractorFactory extractorFactory;
|
final KioskExtractorFactory extractorFactory;
|
||||||
final UIHFactory handler;
|
final UIHFactory handlerFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public KioskList(int service_id) {
|
public KioskList(int service_id) {
|
||||||
@ -73,7 +73,7 @@ public class KioskList {
|
|||||||
throw new ExtractionException("No kiosk found with the type: " + kioskId);
|
throw new ExtractionException("No kiosk found with the type: " + kioskId);
|
||||||
} else {
|
} else {
|
||||||
return ke.extractorFactory.createNewKiosk(NewPipe.getService(service_id),
|
return ke.extractorFactory.createNewKiosk(NewPipe.getService(service_id),
|
||||||
ke.handler.fromId(kioskId).getUrl(), kioskId);
|
ke.handlerFactory.fromId(kioskId).getUrl(), kioskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,14 +85,14 @@ public class KioskList {
|
|||||||
throws ExtractionException, IOException {
|
throws ExtractionException, IOException {
|
||||||
for(Map.Entry<String, KioskEntry> e : kioskList.entrySet()) {
|
for(Map.Entry<String, KioskEntry> e : kioskList.entrySet()) {
|
||||||
KioskEntry ke = e.getValue();
|
KioskEntry ke = e.getValue();
|
||||||
if(ke.handler.acceptUrl(url)) {
|
if(ke.handlerFactory.acceptUrl(url)) {
|
||||||
return getExtractorById(e.getKey(), nextPageUrl);
|
return getExtractorById(e.getKey(), nextPageUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new ExtractionException("Could not find a kiosk that fits to the url: " + url);
|
throw new ExtractionException("Could not find a kiosk that fits to the url: " + url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UIHFactory getUrlIdHandlerByType(String type) {
|
public UIHFactory getUIHFactoryByType(String type) {
|
||||||
return kioskList.get(type).handler;
|
return kioskList.get(type).handlerFactory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public class YoutubeTrendingKioskInfoTest {
|
|||||||
throws Exception {
|
throws Exception {
|
||||||
NewPipe.init(Downloader.getInstance());
|
NewPipe.init(Downloader.getInstance());
|
||||||
StreamingService service = YouTube;
|
StreamingService service = YouTube;
|
||||||
UIHFactory UIHFactory = service.getKioskList().getUrlIdHandlerByType("Trending");
|
UIHFactory UIHFactory = service.getKioskList().getUIHFactoryByType("Trending");
|
||||||
|
|
||||||
kioskInfo = KioskInfo.getInfo(YouTube, UIHFactory.fromId("Trending").getUrl(), null);
|
kioskInfo = KioskInfo.getInfo(YouTube, UIHFactory.fromId("Trending").getUrl(), null);
|
||||||
}
|
}
|
||||||
|
@ -24,13 +24,10 @@ import org.junit.BeforeClass;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.schabi.newpipe.Downloader;
|
import org.schabi.newpipe.Downloader;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
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.exceptions.ParsingException;
|
||||||
import org.schabi.newpipe.extractor.uih.UIHFactory;
|
import org.schabi.newpipe.extractor.uih.UIHFactory;
|
||||||
import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeTrendingUIHFactory;
|
import org.schabi.newpipe.extractor.services.youtube.urlIdHandlers.YoutubeTrendingUIHFactory;
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
|
|
||||||
import static junit.framework.TestCase.assertFalse;
|
import static junit.framework.TestCase.assertFalse;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
@ -44,7 +41,7 @@ public class YoutubeTrendingUIHFactoryTest {
|
|||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUp() throws Exception {
|
public static void setUp() throws Exception {
|
||||||
UIHFactory = YouTube.getKioskList().getUrlIdHandlerByType("Trending");
|
UIHFactory = YouTube.getKioskList().getUIHFactoryByType("Trending");
|
||||||
NewPipe.init(Downloader.getInstance());
|
NewPipe.init(Downloader.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user