ran Code Cleanup

after running Android Studios code cleanup:
320 tests completed, 8 failed, 11 skipped
7 actionable tasks: 4 executed, 3 up-to-date

should not be much different from normal test
This commit is contained in:
BO41 2018-08-22 19:02:34 +02:00
parent b426e2781c
commit dda0af7556
35 changed files with 91 additions and 92 deletions

View File

@ -79,7 +79,7 @@ public abstract class Extractor {
public abstract String getName() throws ParsingException;
@Nonnull
public String getOriginalUrl() throws ParsingException {
public String getOriginalUrl() {
return uIHandler.getOriginalUrl();
}

View File

@ -34,7 +34,7 @@ import java.io.IOException;
public class ChannelInfo extends ListInfo<StreamInfoItem> {
public ChannelInfo(int serviceId, ListLinkHandler urlIdHandler, String name) throws ParsingException {
public ChannelInfo(int serviceId, ListLinkHandler urlIdHandler, String name) {
super(serviceId, urlIdHandler, name);
}
@ -52,7 +52,7 @@ public class ChannelInfo extends ListInfo<StreamInfoItem> {
return service.getChannelExtractor(url).getPage(pageUrl);
}
public static ChannelInfo getInfo(ChannelExtractor extractor) throws IOException, ExtractionException {
public static ChannelInfo getInfo(ChannelExtractor extractor) throws ExtractionException {
ChannelInfo info = new ChannelInfo(extractor.getServiceId(),
extractor.getUIHandler(),

View File

@ -31,7 +31,7 @@ import java.io.IOException;
public class KioskInfo extends ListInfo<StreamInfoItem> {
private KioskInfo(int serviceId, ListLinkHandler urlIdHandler, String name) throws ParsingException {
private KioskInfo(int serviceId, ListLinkHandler urlIdHandler, String name) {
super(serviceId, urlIdHandler, name);
}

View File

@ -11,8 +11,8 @@ public abstract class ListLinkHandlerFactory extends LinkHandlerFactory {
// To Override
///////////////////////////////////
public List<String> getContentFilter(String url) throws ParsingException { return new ArrayList<>(0);}
public String getSortFilter(String url) throws ParsingException {return ""; }
public List<String> getContentFilter(String url) { return new ArrayList<>(0);}
public String getSortFilter(String url) {return ""; }
public abstract String getUrl(String id, List<String> contentFilter, String sortFilter) throws ParsingException;
///////////////////////////////////

View File

@ -14,7 +14,7 @@ import java.io.IOException;
public class PlaylistInfo extends ListInfo<StreamInfoItem> {
private PlaylistInfo(int serviceId, ListLinkHandler urlIdHandler, String name) throws ParsingException {
private PlaylistInfo(int serviceId, ListLinkHandler urlIdHandler, String name) {
super(serviceId, urlIdHandler, name);
}

View File

@ -30,7 +30,7 @@ public class SearchInfo extends ListInfo<InfoItem> {
return getInfo(extractor);
}
public static SearchInfo getInfo(SearchExtractor extractor) throws ExtractionException, IOException {
public static SearchInfo getInfo(SearchExtractor extractor) {
final SearchInfo info = new SearchInfo(
extractor.getServiceId(),
extractor.getUIHandler(),

View File

@ -96,7 +96,7 @@ public class SoundcloudParsingHelper {
*
* @return the url resolved
*/
public static String resolveUrlWithEmbedPlayer(String apiUrl) throws IOException, ReCaptchaException, ParsingException {
public static String resolveUrlWithEmbedPlayer(String apiUrl) throws IOException, ReCaptchaException {
String response = NewPipe.getDownloader().download("https://w.soundcloud.com/player/?url="
+ URLEncoder.encode(apiUrl, "UTF-8"));

View File

@ -37,7 +37,7 @@ public class SoundcloudPlaylistLinkHandlerFactory extends ListLinkHandlerFactory
}
@Override
public boolean onAcceptUrl(final String url) throws ParsingException {
public boolean onAcceptUrl(final String url) {
return Parser.isMatch(URL_PATTERN, url.toLowerCase());
}
}

View File

@ -31,7 +31,7 @@ public class SoundcloudSearchExtractor extends SearchExtractor {
}
@Override
public String getSearchSuggestion() throws ParsingException {
public String getSearchSuggestion() {
return null;
}

View File

@ -121,7 +121,7 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
@Nonnull
@Override
public String getHlsUrl() throws ParsingException {
public String getHlsUrl() {
return "";
}
@ -160,24 +160,24 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
}
@Override
public List<VideoStream> getVideoStreams() throws IOException, ExtractionException {
public List<VideoStream> getVideoStreams() {
return null;
}
@Override
public List<VideoStream> getVideoOnlyStreams() throws IOException, ExtractionException {
public List<VideoStream> getVideoOnlyStreams() {
return null;
}
@Override
@Nonnull
public List<Subtitles> getSubtitlesDefault() throws IOException, ExtractionException {
public List<Subtitles> getSubtitlesDefault() {
return Collections.emptyList();
}
@Override
@Nonnull
public List<Subtitles> getSubtitles(SubtitlesFormat format) throws IOException, ExtractionException {
public List<Subtitles> getSubtitles(SubtitlesFormat format) {
return Collections.emptyList();
}
@ -187,7 +187,7 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
}
@Override
public StreamInfoItem getNextVideo() throws IOException, ExtractionException {
public StreamInfoItem getNextVideo() {
return null;
}

View File

@ -38,7 +38,7 @@ public class SoundcloudStreamLinkHandlerFactory extends LinkHandlerFactory {
}
@Override
public boolean onAcceptUrl(final String url) throws ParsingException {
public boolean onAcceptUrl(final String url) {
return Parser.isMatch(URL_PATTERN, url.toLowerCase());
}
}

View File

@ -69,12 +69,12 @@ public class YoutubeService extends StreamingService {
}
@Override
public StreamExtractor getStreamExtractor(LinkHandler linkHandler) throws ExtractionException {
public StreamExtractor getStreamExtractor(LinkHandler linkHandler) {
return new YoutubeStreamExtractor(this, linkHandler);
}
@Override
public ChannelExtractor getChannelExtractor(ListLinkHandler urlIdHandler) throws ExtractionException {
public ChannelExtractor getChannelExtractor(ListLinkHandler urlIdHandler) {
return new YoutubeChannelExtractor(this, urlIdHandler);
}

View File

@ -266,12 +266,12 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
}
@Override
public String getUploaderName() throws ParsingException {
public String getUploaderName() {
return uploaderName;
}
@Override
public String getUploaderUrl() throws ParsingException {
public String getUploaderUrl() {
return uploaderUrl;
}

View File

@ -33,7 +33,7 @@ public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor
}
@Override
public String getThumbnailUrl() throws ParsingException {
public String getThumbnailUrl() {
Element img = el.select("span[class*=\"yt-thumb-simple\"]").first()
.select("img").first();
@ -46,13 +46,13 @@ public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor
}
@Override
public String getName() throws ParsingException {
public String getName() {
return el.select("a[class*=\"yt-uix-tile-link\"]").first()
.text();
}
@Override
public String getUrl() throws ParsingException {
public String getUrl() {
return el.select("a[class*=\"yt-uix-tile-link\"]").first()
.attr("abs:href");
}
@ -73,7 +73,7 @@ public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor
}
@Override
public long getStreamCount() throws ParsingException {
public long getStreamCount() {
Element metaEl = el.select("ul[class*=\"yt-lockup-meta-info\"]").first();
if (metaEl == null) {
return 0;
@ -83,7 +83,7 @@ public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor
}
@Override
public String getDescription() throws ParsingException {
public String getDescription() {
Element desEl = el.select("div[class*=\"yt-lockup-description\"]").first();
if (desEl == null) {
return "";

View File

@ -28,7 +28,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
private Document doc;
public YoutubePlaylistExtractor(StreamingService service, ListLinkHandler urlIdHandler) throws ExtractionException {
public YoutubePlaylistExtractor(StreamingService service, ListLinkHandler urlIdHandler) {
super(service, urlIdHandler);
}
@ -241,22 +241,22 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
}
@Override
public String getUploaderName() throws ParsingException {
public String getUploaderName() {
return getUploaderLink().text();
}
@Override
public String getUploaderUrl() throws ParsingException {
public String getUploaderUrl() {
return getUploaderLink().attr("abs:href");
}
@Override
public String getUploadDate() throws ParsingException {
public String getUploadDate() {
return "";
}
@Override
public long getViewCount() throws ParsingException {
public long getViewCount() {
return -1;
}

View File

@ -67,7 +67,7 @@ public class YoutubeSearchExtractor extends SearchExtractor {
}
@Override
public String getSearchSuggestion() throws ParsingException {
public String getSearchSuggestion() {
final Element el = doc.select("div[class*=\"spell-correction\"]").first();
if (el != null) {
return el.select("a").first().text();
@ -78,7 +78,7 @@ public class YoutubeSearchExtractor extends SearchExtractor {
@Nonnull
@Override
public InfoItemsPage<InfoItem> getInitialPage() throws IOException, ExtractionException {
public InfoItemsPage<InfoItem> getInitialPage() throws ExtractionException {
return new InfoItemsPage<>(collectItems(doc), getNextPageUrl());
}

View File

@ -400,7 +400,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
}
@Override
public List<AudioStream> getAudioStreams() throws IOException, ExtractionException {
public List<AudioStream> getAudioStreams() throws ExtractionException {
assertPageFetched();
List<AudioStream> audioStreams = new ArrayList<>();
try {
@ -420,7 +420,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
}
@Override
public List<VideoStream> getVideoStreams() throws IOException, ExtractionException {
public List<VideoStream> getVideoStreams() throws ExtractionException {
assertPageFetched();
List<VideoStream> videoStreams = new ArrayList<>();
try {
@ -467,7 +467,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
@Override
@Nonnull
public List<Subtitles> getSubtitles(final SubtitlesFormat format) throws IOException, ExtractionException {
public List<Subtitles> getSubtitles(final SubtitlesFormat format) {
assertPageFetched();
List<Subtitles> subtitles = new ArrayList<>();
for (final SubtitlesInfo subtitlesInfo : subtitlesInfos) {
@ -491,7 +491,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
}
@Override
public StreamInfoItem getNextVideo() throws IOException, ExtractionException {
public StreamInfoItem getNextVideo() throws ExtractionException {
assertPageFetched();
try {
StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId());
@ -505,7 +505,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
}
@Override
public StreamInfoItemsCollector getRelatedVideos() throws IOException, ExtractionException {
public StreamInfoItemsCollector getRelatedVideos() throws ExtractionException {
assertPageFetched();
try {
StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId());
@ -889,12 +889,12 @@ public class YoutubeStreamExtractor extends StreamExtractor {
return new YoutubeStreamInfoItemExtractor(li) {
@Override
public String getUrl() throws ParsingException {
public String getUrl() {
return li.select("a.content-link").first().attr("abs:href");
}
@Override
public String getName() throws ParsingException {
public String getName() {
//todo: check NullPointerException causing
return li.select("span.title").first().text();
//this page causes the NullPointerException, after finding it by searching for "tjvg":
@ -902,23 +902,23 @@ public class YoutubeStreamExtractor extends StreamExtractor {
}
@Override
public String getUploaderName() throws ParsingException {
public String getUploaderName() {
return li.select("span[class*=\"attribution\"").first()
.select("span").first().text();
}
@Override
public String getUploaderUrl() throws ParsingException {
public String getUploaderUrl() {
return ""; // The uploader is not linked
}
@Override
public String getUploadDate() throws ParsingException {
public String getUploadDate() {
return "";
}
@Override
public long getViewCount() throws ParsingException {
public long getViewCount() {
try {
if (getStreamType() == StreamType.LIVE_STREAM) return -1;
@ -931,7 +931,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
}
@Override
public String getThumbnailUrl() throws ParsingException {
public String getThumbnailUrl() {
Element img = li.select("img").first();
String thumbnailUrl = img.attr("abs:src");
// Sometimes youtube sends links to gif files which somehow seem to not exist

View File

@ -34,7 +34,7 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
}
@Override
public StreamType getStreamType() throws ParsingException {
public StreamType getStreamType() {
if (isLiveStream(item)) {
return StreamType.LIVE_STREAM;
} else {
@ -43,7 +43,7 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
}
@Override
public boolean isAd() throws ParsingException {
public boolean isAd() {
return !item.select("span[class*=\"icon-not-available\"]").isEmpty()
|| !item.select("span[class*=\"yt-badge-ad\"]").isEmpty()
|| isPremiumVideo();
@ -54,8 +54,7 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
if(premiumSpan == null) return false;
// if this span has text it most likely says ("Free Video") so we can play this
if(premiumSpan.hasText()) return false;
return true;
return !premiumSpan.hasText();
}
@Override

View File

@ -83,7 +83,7 @@ public class YoutubeTrendingExtractor extends KioskExtractor {
@Nonnull
@Override
public InfoItemsPage<StreamInfoItem> getInitialPage() throws ParsingException {
public InfoItemsPage<StreamInfoItem> getInitialPage() {
StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId());
Elements uls = doc.select("ul[class*=\"expanded-shelf-content-list\"]");
for(Element ul : uls) {

View File

@ -102,7 +102,7 @@ public abstract class StreamExtractor extends Extractor {
}
} else {
return 0;
}};
}}
public abstract long getViewCount() throws ParsingException;
public abstract long getLikeCount() throws ParsingException;

View File

@ -10,12 +10,12 @@ import static org.schabi.newpipe.extractor.ServiceList.YouTube;
public class NewPipeTest {
@Test
public void getAllServicesTest() throws Exception {
public void getAllServicesTest() {
assertEquals(NewPipe.getServices().size(), ServiceList.all().size());
}
@Test
public void testAllServicesHaveDifferentId() throws Exception {
public void testAllServicesHaveDifferentId() {
HashSet<Integer> servicesId = new HashSet<>();
for (StreamingService streamingService : NewPipe.getServices()) {
String errorMsg = "There are services with the same id = " + streamingService.getServiceId() + " (current service > " + streamingService.getServiceInfo().getName() + ")";
@ -44,12 +44,12 @@ public class NewPipeTest {
}
@Test
public void getIdWithServiceName() throws Exception {
public void getIdWithServiceName() {
assertEquals(NewPipe.getIdOfService(YouTube.getServiceInfo().getName()), YouTube.getServiceId());
}
@Test
public void getServiceNameWithId() throws Exception {
public void getServiceNameWithId() {
assertEquals(NewPipe.getNameOfService(YouTube.getServiceId()), YouTube.getServiceInfo().getName());
}
}

View File

@ -31,7 +31,7 @@ public class SoundcloudChartsExtractorTest {
}
@Test
public void testGetDownloader() throws Exception {
public void testGetDownloader() {
assertNotNull(NewPipe.getDownloader());
}

View File

@ -17,7 +17,7 @@ public class SoundcloudChartsLinkHandlerFactoryTest {
private static SoundcloudChartsLinkHandlerFactory urlIdHandler;
@BeforeClass
public static void setUp() throws Exception {
public static void setUp() {
urlIdHandler = new SoundcloudChartsLinkHandlerFactory();
NewPipe.init(Downloader.getInstance());
}

View File

@ -36,33 +36,33 @@ public class SoundcloudStreamExtractorDefaultTest {
}
@Test
public void testGetValidTimeStamp() throws IOException, ExtractionException {
public void testGetValidTimeStamp() throws ExtractionException {
StreamExtractor extractor = SoundCloud.getStreamExtractor("https://soundcloud.com/liluzivert/do-what-i-want-produced-by-maaly-raw-don-cannon#t=69");
assertEquals(extractor.getTimeStamp() + "", "69");
}
@Test
public void testGetTitle() throws ParsingException {
public void testGetTitle() {
assertEquals(extractor.getName(), "Do What I Want [Produced By Maaly Raw + Don Cannon]");
}
@Test
public void testGetDescription() throws ParsingException {
public void testGetDescription() {
assertEquals(extractor.getDescription(), "The Perfect LUV Tape®");
}
@Test
public void testGetUploaderName() throws ParsingException {
public void testGetUploaderName() {
assertEquals(extractor.getUploaderName(), "LIL UZI VERT");
}
@Test
public void testGetLength() throws ParsingException {
public void testGetLength() {
assertEquals(extractor.getLength(), 175);
}
@Test
public void testGetViewCount() throws ParsingException {
public void testGetViewCount() {
assertTrue(Long.toString(extractor.getViewCount()),
extractor.getViewCount() > 44227978);
}
@ -73,18 +73,18 @@ public class SoundcloudStreamExtractorDefaultTest {
}
@Test
public void testGetUploaderUrl() throws ParsingException {
public void testGetUploaderUrl() {
assertIsSecureUrl(extractor.getUploaderUrl());
assertEquals("https://soundcloud.com/liluzivert", extractor.getUploaderUrl());
}
@Test
public void testGetThumbnailUrl() throws ParsingException {
public void testGetThumbnailUrl() {
assertIsSecureUrl(extractor.getThumbnailUrl());
}
@Test
public void testGetUploaderAvatarUrl() throws ParsingException {
public void testGetUploaderAvatarUrl() {
assertIsSecureUrl(extractor.getUploaderAvatarUrl());
}
@ -94,7 +94,7 @@ public class SoundcloudStreamExtractorDefaultTest {
}
@Test
public void testStreamType() throws ParsingException {
public void testStreamType() {
assertTrue(extractor.getStreamType() == StreamType.AUDIO_STREAM);
}

View File

@ -18,7 +18,7 @@ public class SoundcloudStreamLinkHandlerFactoryTest {
private static SoundcloudStreamLinkHandlerFactory urlIdHandler;
@BeforeClass
public static void setUp() throws Exception {
public static void setUp() {
urlIdHandler = SoundcloudStreamLinkHandlerFactory.getInstance();
NewPipe.init(Downloader.getInstance());
}

View File

@ -19,7 +19,7 @@ public class SoundcloudSuggestionExtractorTest {
private static SuggestionExtractor suggestionExtractor;
@BeforeClass
public static void setUp() throws Exception {
public static void setUp() {
NewPipe.init(Downloader.getInstance());
suggestionExtractor = SoundCloud.getSuggestionExtractor();
}

View File

@ -15,7 +15,7 @@ import static org.schabi.newpipe.extractor.services.soundcloud.SoundcloudSearchQ
public class SoundcloudSearchQHTest {
@BeforeClass
public static void setUpClass() throws Exception {
public static void setUpClass() {
NewPipe.init(Downloader.getInstance());
}
@ -41,21 +41,21 @@ public class SoundcloudSearchQHTest {
@Test
public void testGetContentFilter() throws Exception {
assertEquals("tracks", SoundCloud.getSearchQHFactory()
.fromQuery("", asList(new String[]{"tracks"}), "").getContentFilters().get(0));
.fromQuery("", asList("tracks"), "").getContentFilters().get(0));
assertEquals("users", SoundCloud.getSearchQHFactory()
.fromQuery("asdf", asList(new String[]{"users"}), "").getContentFilters().get(0));
.fromQuery("asdf", asList("users"), "").getContentFilters().get(0));
}
@Test
public void testWithContentfilter() throws Exception {
assertEquals("https://api-v2.soundcloud.com/search/tracks?q=asdf&limit=10&offset=0", removeClientId(SoundCloud.getSearchQHFactory()
.fromQuery("asdf", asList(new String[]{TRACKS}), "").getUrl()));
.fromQuery("asdf", asList(TRACKS), "").getUrl()));
assertEquals("https://api-v2.soundcloud.com/search/users?q=asdf&limit=10&offset=0", removeClientId(SoundCloud.getSearchQHFactory()
.fromQuery("asdf", asList(new String[]{USERS}), "").getUrl()));
.fromQuery("asdf", asList(USERS), "").getUrl()));
assertEquals("https://api-v2.soundcloud.com/search/playlists?q=asdf&limit=10&offset=0", removeClientId(SoundCloud.getSearchQHFactory()
.fromQuery("asdf", asList(new String[]{PLAYLISTS}), "").getUrl()));
.fromQuery("asdf", asList(PLAYLISTS), "").getUrl()));
assertEquals("https://api-v2.soundcloud.com/search?q=asdf&limit=10&offset=0", removeClientId(SoundCloud.getSearchQHFactory()
.fromQuery("asdf", asList(new String[]{"fjiijie"}), "").getUrl()));
.fromQuery("asdf", asList("fjiijie"), "").getUrl()));
}
@Test

View File

@ -506,5 +506,5 @@ public class YoutubeChannelExtractorTest {
assertTrue(extractor.getDonationLinks().length == 0);
}
}
};
}

View File

@ -91,7 +91,7 @@ public class YoutubePlaylistExtractorTest {
@Ignore
@Test
public void testBannerUrl() throws Exception {
public void testBannerUrl() {
final String bannerUrl = extractor.getBannerUrl();
assertIsSecureUrl(bannerUrl);
assertTrue(bannerUrl, bannerUrl.contains("yt"));
@ -205,7 +205,7 @@ public class YoutubePlaylistExtractorTest {
@Ignore
@Test
public void testBannerUrl() throws Exception {
public void testBannerUrl() {
final String bannerUrl = extractor.getBannerUrl();
assertIsSecureUrl(bannerUrl);
assertTrue(bannerUrl, bannerUrl.contains("yt"));

View File

@ -46,7 +46,7 @@ public class YoutubeServiceTest {
}
@Test
public void testGetKioskAvailableKiosks() throws Exception {
public void testGetKioskAvailableKiosks() {
assertFalse("No kiosk got returned", kioskList.getAvailableKiosks().isEmpty());
}

View File

@ -42,7 +42,7 @@ public class YoutubeStreamExtractorAgeRestrictedTest {
}
@Test
public void testGetValidTimeStamp() throws IOException, ExtractionException {
public void testGetValidTimeStamp() throws ExtractionException {
StreamExtractor extractor = YouTube.getStreamExtractor("https://youtu.be/FmG385_uUys?t=174");
assertEquals(extractor.getTimeStamp() + "", "174");
}

View File

@ -41,7 +41,7 @@ public class YoutubeStreamExtractorControversialTest {
}
@Test
public void testGetValidTimeStamp() throws IOException, ExtractionException {
public void testGetValidTimeStamp() throws ExtractionException {
StreamExtractor extractor = YouTube.getStreamExtractor("https://youtu.be/FmG385_uUys?t=174");
assertEquals(extractor.getTimeStamp() + "", "174");
}

View File

@ -39,7 +39,7 @@ public class YoutubeSuggestionExtractorTest {
private static SuggestionExtractor suggestionExtractor;
@BeforeClass
public static void setUp() throws Exception {
public static void setUp() {
NewPipe.init(Downloader.getInstance());
suggestionExtractor = YouTube.getSuggestionExtractor();
}

View File

@ -54,7 +54,7 @@ public class YoutubeTrendingExtractorTest {
}
@Test
public void testGetDownloader() throws Exception {
public void testGetDownloader() {
assertNotNull(NewPipe.getDownloader());
}
@ -64,7 +64,7 @@ public class YoutubeTrendingExtractorTest {
}
@Test
public void testId() throws Exception {
public void testId() {
assertEquals(extractor.getId(), "Trending");
}

View File

@ -24,21 +24,21 @@ public class YoutubeSearchQHTest {
@Test
public void testGetContentFilter() throws Exception {
assertEquals(VIDEOS, YouTube.getSearchQHFactory()
.fromQuery("", asList(new String[]{VIDEOS}), "").getContentFilters().get(0));
.fromQuery("", asList(VIDEOS), "").getContentFilters().get(0));
assertEquals(CHANNELS, YouTube.getSearchQHFactory()
.fromQuery("asdf", asList(new String[]{CHANNELS}), "").getContentFilters().get(0));
.fromQuery("asdf", asList(CHANNELS), "").getContentFilters().get(0));
}
@Test
public void testWithContentfilter() throws Exception {
assertEquals("https://www.youtube.com/results?q=asdf&sp=EgIQAVAU", YouTube.getSearchQHFactory()
.fromQuery("asdf", asList(new String[]{VIDEOS}), "").getUrl());
.fromQuery("asdf", asList(VIDEOS), "").getUrl());
assertEquals("https://www.youtube.com/results?q=asdf&sp=EgIQAlAU", YouTube.getSearchQHFactory()
.fromQuery("asdf", asList(new String[]{CHANNELS}), "").getUrl());
.fromQuery("asdf", asList(CHANNELS), "").getUrl());
assertEquals("https://www.youtube.com/results?q=asdf&sp=EgIQA1AU", YouTube.getSearchQHFactory()
.fromQuery("asdf", asList(new String[]{PLAYLISTS}), "").getUrl());
.fromQuery("asdf", asList(PLAYLISTS), "").getUrl());
assertEquals("https://www.youtube.com/results?q=asdf", YouTube.getSearchQHFactory()
.fromQuery("asdf", asList(new String[]{"fjiijie"}), "").getUrl());
.fromQuery("asdf", asList("fjiijie"), "").getUrl());
}
@Test