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

@@ -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(""));
}
}