From c33ee3e40929c6e892ac5997c77df2b2d39741c9 Mon Sep 17 00:00:00 2001 From: wb9688 Date: Mon, 7 Aug 2017 18:12:51 +0200 Subject: [PATCH] Rename some stuff --- .../schabi/newpipe/extractor/Extractor.java | 2 +- .../schabi/newpipe/extractor/InfoItem.java | 2 +- .../newpipe/extractor/ListExtractor.java | 2 +- .../schabi/newpipe/extractor/ServiceList.java | 2 +- .../newpipe/extractor/StreamingService.java | 18 +++++----- .../newpipe/extractor/UrlIdHandler.java | 8 ++--- .../search/InfoItemSearchCollector.java | 14 ++++---- .../extractor/search/SearchEngine.java | 2 +- .../SoundcloudPlaylistUrlIdHandler.java | 8 ++--- .../soundcloud/SoundcloudSearchEngine.java | 6 ++-- .../soundcloud/SoundcloudService.java | 10 +++--- .../soundcloud/SoundcloudStreamExtractor.java | 2 +- .../SoundcloudStreamUrlIdHandler.java | 8 ++--- ...ctor.java => SoundcloudUserExtractor.java} | 36 +++++++++---------- ...a => SoundcloudUserInfoItemExtractor.java} | 8 ++--- ...r.java => SoundcloudUserUrlIdHandler.java} | 14 ++++---- .../youtube/YoutubePlaylistUrlIdHandler.java | 12 +++---- .../services/youtube/YoutubeSearchEngine.java | 6 ++-- .../services/youtube/YoutubeService.java | 10 +++--- .../youtube/YoutubeStreamExtractor.java | 2 +- .../youtube/YoutubeStreamUrlIdHandler.java | 10 +++--- ...tractor.java => YoutubeUserExtractor.java} | 14 ++++---- ...java => YoutubeUserInfoItemExtractor.java} | 10 +++--- ...dler.java => YoutubeUserUrlIdHandler.java} | 30 ++++++++-------- .../extractor/stream/StreamExtractor.java | 2 +- .../newpipe/extractor/stream/StreamInfo.java | 4 +-- .../UserExtractor.java} | 14 ++++---- .../ChannelInfo.java => user/UserInfo.java} | 24 ++++++------- .../UserInfoItem.java} | 10 +++--- .../UserInfoItemCollector.java} | 16 ++++----- .../UserInfoItemExtractor.java} | 8 ++--- .../schabi/newpipe/extractor/NewPipeTest.java | 26 +++++++------- .../youtube/YoutubePlaylistExtractorTest.java | 4 +-- .../youtube/YoutubeSearchEngineAllTest.java | 6 ++-- .../YoutubeSearchEngineStreamTest.java | 4 +-- ....java => YoutubeSearchEngineUserTest.java} | 12 +++---- .../YoutubeStreamExtractorDefaultTest.java | 10 +++--- .../YoutubeStreamExtractorGemaTest.java | 4 +-- .../YoutubeStreamExtractorRestrictedTest.java | 6 ++-- .../YoutubeSuggestionExtractorTest.java | 4 +-- ...est.java => YoutubeUserExtractorTest.java} | 18 +++++----- 41 files changed, 204 insertions(+), 204 deletions(-) rename src/main/java/org/schabi/newpipe/extractor/services/soundcloud/{SoundcloudChannelExtractor.java => SoundcloudUserExtractor.java} (69%) rename src/main/java/org/schabi/newpipe/extractor/services/soundcloud/{SoundcloudChannelInfoItemExtractor.java => SoundcloudUserInfoItemExtractor.java} (75%) rename src/main/java/org/schabi/newpipe/extractor/services/soundcloud/{SoundcloudChannelUrlIdHandler.java => SoundcloudUserUrlIdHandler.java} (74%) rename src/main/java/org/schabi/newpipe/extractor/services/youtube/{YoutubeChannelExtractor.java => YoutubeUserExtractor.java} (96%) rename src/main/java/org/schabi/newpipe/extractor/services/youtube/{YoutubeChannelInfoItemExtractor.java => YoutubeUserInfoItemExtractor.java} (88%) rename src/main/java/org/schabi/newpipe/extractor/services/youtube/{YoutubeChannelUrlIdHandler.java => YoutubeUserUrlIdHandler.java} (58%) rename src/main/java/org/schabi/newpipe/extractor/{channel/ChannelExtractor.java => user/UserExtractor.java} (76%) rename src/main/java/org/schabi/newpipe/extractor/{channel/ChannelInfo.java => user/UserInfo.java} (79%) rename src/main/java/org/schabi/newpipe/extractor/{channel/ChannelInfoItem.java => user/UserInfoItem.java} (82%) rename src/main/java/org/schabi/newpipe/extractor/{channel/ChannelInfoItemCollector.java => user/UserInfoItemCollector.java} (78%) rename src/main/java/org/schabi/newpipe/extractor/{channel/ChannelInfoItemExtractor.java => user/UserInfoItemExtractor.java} (84%) rename src/test/java/org/schabi/newpipe/extractor/services/youtube/{YoutubeSearchEngineChannelTest.java => YoutubeSearchEngineUserTest.java} (86%) rename src/test/java/org/schabi/newpipe/extractor/services/youtube/{YoutubeChannelExtractorTest.java => YoutubeUserExtractorTest.java} (85%) diff --git a/src/main/java/org/schabi/newpipe/extractor/Extractor.java b/src/main/java/org/schabi/newpipe/extractor/Extractor.java index 39a39ae0..9fd4c162 100644 --- a/src/main/java/org/schabi/newpipe/extractor/Extractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/Extractor.java @@ -37,7 +37,7 @@ public abstract class Extractor { } /** - * @return a {@link UrlIdHandler} of the current extractor type (e.g. a ChannelExtractor should return a channel url handler). + * @return a {@link UrlIdHandler} of the current extractor type (e.g. a UserExtractor should return a user url handler). */ protected abstract UrlIdHandler getUrlIdHandler() throws ParsingException; diff --git a/src/main/java/org/schabi/newpipe/extractor/InfoItem.java b/src/main/java/org/schabi/newpipe/extractor/InfoItem.java index db9450f0..1c132e8c 100644 --- a/src/main/java/org/schabi/newpipe/extractor/InfoItem.java +++ b/src/main/java/org/schabi/newpipe/extractor/InfoItem.java @@ -26,7 +26,7 @@ public abstract class InfoItem implements Serializable { public enum InfoType { STREAM, PLAYLIST, - CHANNEL + USER } public InfoItem(InfoType infoType) { diff --git a/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java b/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java index 7af2f75e..d4746270 100644 --- a/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java @@ -7,7 +7,7 @@ import java.io.IOException; import java.util.List; /** - * Base class to extractors that have a list (e.g. playlists, channels). + * Base class to extractors that have a list (e.g. playlists, users). */ public abstract class ListExtractor extends Extractor { protected String nextStreamsUrl; diff --git a/src/main/java/org/schabi/newpipe/extractor/ServiceList.java b/src/main/java/org/schabi/newpipe/extractor/ServiceList.java index 64f79ff2..1f493e40 100644 --- a/src/main/java/org/schabi/newpipe/extractor/ServiceList.java +++ b/src/main/java/org/schabi/newpipe/extractor/ServiceList.java @@ -7,7 +7,7 @@ import org.schabi.newpipe.extractor.services.youtube.YoutubeService; * A list of supported services. */ public enum ServiceList { - Youtube(new YoutubeService(0, "Youtube")), + YouTube(new YoutubeService(0, "YouTube")), SoundCloud(new SoundcloudService(1, "SoundCloud")); // DailyMotion(new DailyMotionService(2, "DailyMotion")); diff --git a/src/main/java/org/schabi/newpipe/extractor/StreamingService.java b/src/main/java/org/schabi/newpipe/extractor/StreamingService.java index ae2241f3..039a0e79 100644 --- a/src/main/java/org/schabi/newpipe/extractor/StreamingService.java +++ b/src/main/java/org/schabi/newpipe/extractor/StreamingService.java @@ -1,10 +1,10 @@ package org.schabi.newpipe.extractor; -import org.schabi.newpipe.extractor.channel.ChannelExtractor; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; import org.schabi.newpipe.extractor.search.SearchEngine; import org.schabi.newpipe.extractor.stream.StreamExtractor; +import org.schabi.newpipe.extractor.user.UserExtractor; import java.io.IOException; @@ -20,7 +20,7 @@ public abstract class StreamingService { public enum LinkType { NONE, STREAM, - CHANNEL, + USER, PLAYLIST } @@ -41,16 +41,16 @@ public abstract class StreamingService { } public abstract UrlIdHandler getStreamUrlIdHandler(); - public abstract UrlIdHandler getChannelUrlIdHandler(); + public abstract UrlIdHandler getUserUrlIdHandler(); public abstract UrlIdHandler getPlaylistUrlIdHandler(); public abstract SearchEngine getSearchEngine(); public abstract SuggestionExtractor getSuggestionExtractor(); public abstract StreamExtractor getStreamExtractor(String url) throws IOException, ExtractionException; - public abstract ChannelExtractor getChannelExtractor(String url, String nextStreamsUrl) throws IOException, ExtractionException; + public abstract UserExtractor getUserExtractor(String url, String nextStreamsUrl) throws IOException, ExtractionException; public abstract PlaylistExtractor getPlaylistExtractor(String url, String nextStreamsUrl) throws IOException, ExtractionException; - public ChannelExtractor getChannelExtractor(String url) throws IOException, ExtractionException { - return getChannelExtractor(url, null); + public UserExtractor getUserExtractor(String url) throws IOException, ExtractionException { + return getUserExtractor(url, null); } public PlaylistExtractor getPlaylistExtractor(String url) throws IOException, ExtractionException { @@ -58,17 +58,17 @@ public abstract class StreamingService { } /** - * figure out where the link is pointing to (a channel, video, playlist, etc.) + * figure out where the link is pointing to (a user, video, playlist, etc.) */ public final LinkType getLinkTypeByUrl(String url) { UrlIdHandler sH = getStreamUrlIdHandler(); - UrlIdHandler cH = getChannelUrlIdHandler(); + UrlIdHandler cH = getUserUrlIdHandler(); UrlIdHandler pH = getPlaylistUrlIdHandler(); if (sH.acceptUrl(url)) { return LinkType.STREAM; } else if (cH.acceptUrl(url)) { - return LinkType.CHANNEL; + return LinkType.USER; } else if (pH.acceptUrl(url)) { return LinkType.PLAYLIST; } else { diff --git a/src/main/java/org/schabi/newpipe/extractor/UrlIdHandler.java b/src/main/java/org/schabi/newpipe/extractor/UrlIdHandler.java index 84a80b9d..6fe43ec8 100644 --- a/src/main/java/org/schabi/newpipe/extractor/UrlIdHandler.java +++ b/src/main/java/org/schabi/newpipe/extractor/UrlIdHandler.java @@ -24,14 +24,14 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException; public interface UrlIdHandler { - String getUrl(String videoId) throws ParsingException; - String getId(String siteUrl) throws ParsingException; - String cleanUrl(String siteUrl) throws ParsingException; + String getUrl(String id) throws ParsingException; + String getId(String url) throws ParsingException; + String cleanUrl(String complexUrl) throws ParsingException; /** * When a VIEW_ACTION is caught this function will test if the url delivered within the calling * Intent was meant to be watched with this Service. * Return false if this service shall not allow to be called through ACTIONs. */ - boolean acceptUrl(String videoUrl); + boolean acceptUrl(String url); } diff --git a/src/main/java/org/schabi/newpipe/extractor/search/InfoItemSearchCollector.java b/src/main/java/org/schabi/newpipe/extractor/search/InfoItemSearchCollector.java index 9dc64798..45a8100e 100644 --- a/src/main/java/org/schabi/newpipe/extractor/search/InfoItemSearchCollector.java +++ b/src/main/java/org/schabi/newpipe/extractor/search/InfoItemSearchCollector.java @@ -1,12 +1,12 @@ package org.schabi.newpipe.extractor.search; import org.schabi.newpipe.extractor.InfoItemCollector; -import org.schabi.newpipe.extractor.channel.ChannelInfoItemCollector; -import org.schabi.newpipe.extractor.channel.ChannelInfoItemExtractor; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.FoundAdException; import org.schabi.newpipe.extractor.stream.StreamInfoItemCollector; import org.schabi.newpipe.extractor.stream.StreamInfoItemExtractor; +import org.schabi.newpipe.extractor.user.UserInfoItemCollector; +import org.schabi.newpipe.extractor.user.UserInfoItemExtractor; /* * Created by Christian Schabesberger on 12.02.17. @@ -31,14 +31,14 @@ import org.schabi.newpipe.extractor.stream.StreamInfoItemExtractor; public class InfoItemSearchCollector extends InfoItemCollector { private String suggestion; private StreamInfoItemCollector streamCollector; - private ChannelInfoItemCollector channelCollector; + private UserInfoItemCollector userCollector; private SearchResult result = new SearchResult(); InfoItemSearchCollector(int serviceId) { super(serviceId); streamCollector = new StreamInfoItemCollector(serviceId); - channelCollector = new ChannelInfoItemCollector(serviceId); + userCollector = new UserInfoItemCollector(serviceId); } public void setSuggestion(String suggestion) { @@ -47,7 +47,7 @@ public class InfoItemSearchCollector extends InfoItemCollector { public SearchResult getSearchResult() throws ExtractionException { - addFromCollector(channelCollector); + addFromCollector(userCollector); addFromCollector(streamCollector); result.suggestion = suggestion; @@ -65,9 +65,9 @@ public class InfoItemSearchCollector extends InfoItemCollector { } } - public void commit(ChannelInfoItemExtractor extractor) { + public void commit(UserInfoItemExtractor extractor) { try { - result.resultList.add(channelCollector.extract(extractor)); + result.resultList.add(userCollector.extract(extractor)); } catch (FoundAdException ae) { System.err.println("Found ad"); } catch (Exception e) { diff --git a/src/main/java/org/schabi/newpipe/extractor/search/SearchEngine.java b/src/main/java/org/schabi/newpipe/extractor/search/SearchEngine.java index 83308136..ea7112bd 100644 --- a/src/main/java/org/schabi/newpipe/extractor/search/SearchEngine.java +++ b/src/main/java/org/schabi/newpipe/extractor/search/SearchEngine.java @@ -27,7 +27,7 @@ import java.util.EnumSet; public abstract class SearchEngine { public enum Filter { - STREAM, CHANNEL, PLAYLIST + STREAM, USER, PLAYLIST } public static class NothingFoundException extends ExtractionException { diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistUrlIdHandler.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistUrlIdHandler.java index 4b5b7ee3..5e8ee0e5 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistUrlIdHandler.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistUrlIdHandler.java @@ -16,9 +16,9 @@ public class SoundcloudPlaylistUrlIdHandler implements UrlIdHandler { } @Override - public String getUrl(String listId) throws ParsingException { + public String getUrl(String id) throws ParsingException { try { - return SoundcloudParsingHelper.resolveUrlWithEmbedPlayer("https://api.soundcloud.com/playlists/" + listId); + return SoundcloudParsingHelper.resolveUrlWithEmbedPlayer("https://api.soundcloud.com/playlists/" + id); } catch (Exception e) { throw new ParsingException(e.getMessage(), e); } @@ -46,8 +46,8 @@ public class SoundcloudPlaylistUrlIdHandler implements UrlIdHandler { } @Override - public boolean acceptUrl(String videoUrl) { + public boolean acceptUrl(String url) { String regex = "^https?://(www\\.)?soundcloud.com/[0-9a-z_-]+/sets/[0-9a-z_-]+/?([#?].*)?$"; - return Parser.isMatch(regex, videoUrl.toLowerCase()); + return Parser.isMatch(regex, url.toLowerCase()); } } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchEngine.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchEngine.java index 757ff51b..9b04341c 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchEngine.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudSearchEngine.java @@ -27,9 +27,9 @@ public class SoundcloudSearchEngine extends SearchEngine { String url = "https://api-v2.soundcloud.com/search"; - if (filter.contains(Filter.STREAM) && !filter.contains(Filter.CHANNEL)) { + if (filter.contains(Filter.STREAM) && !filter.contains(Filter.USER)) { url += "/tracks"; - } else if (!filter.contains(Filter.STREAM) && filter.contains(Filter.CHANNEL)) { + } else if (!filter.contains(Filter.STREAM) && filter.contains(Filter.USER)) { url += "/users"; } @@ -50,7 +50,7 @@ public class SoundcloudSearchEngine extends SearchEngine { JSONObject searchResult = searchCollection.getJSONObject(i); String kind = searchResult.getString("kind"); if (kind.equals("user")) { - collector.commit(new SoundcloudChannelInfoItemExtractor(searchResult)); + collector.commit(new SoundcloudUserInfoItemExtractor(searchResult)); } else if (kind.equals("track")) { collector.commit(new SoundcloudStreamInfoItemExtractor(searchResult)); } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudService.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudService.java index 80c565ac..788f6607 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudService.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudService.java @@ -3,11 +3,11 @@ package org.schabi.newpipe.extractor.services.soundcloud; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.SuggestionExtractor; import org.schabi.newpipe.extractor.UrlIdHandler; -import org.schabi.newpipe.extractor.channel.ChannelExtractor; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; import org.schabi.newpipe.extractor.search.SearchEngine; import org.schabi.newpipe.extractor.stream.StreamExtractor; +import org.schabi.newpipe.extractor.user.UserExtractor; import java.io.IOException; @@ -28,8 +28,8 @@ public class SoundcloudService extends StreamingService { } @Override - public UrlIdHandler getChannelUrlIdHandler() { - return SoundcloudChannelUrlIdHandler.getInstance(); + public UrlIdHandler getUserUrlIdHandler() { + return SoundcloudUserUrlIdHandler.getInstance(); } @Override @@ -44,8 +44,8 @@ public class SoundcloudService extends StreamingService { } @Override - public ChannelExtractor getChannelExtractor(String url, String nextStreamsUrl) throws IOException, ExtractionException { - return new SoundcloudChannelExtractor(this, url, nextStreamsUrl); + public UserExtractor getUserExtractor(String url, String nextStreamsUrl) throws IOException, ExtractionException { + return new SoundcloudUserExtractor(this, url, nextStreamsUrl); } @Override diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java index f75ec06d..9cf61137 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java @@ -215,7 +215,7 @@ public class SoundcloudStreamExtractor extends StreamExtractor { } @Override - public String getChannelUrl() { + public String getUserUrl() { return track.getJSONObject("user").getString("permalink_url"); } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUrlIdHandler.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUrlIdHandler.java index 0baf47c3..34a52515 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUrlIdHandler.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamUrlIdHandler.java @@ -19,9 +19,9 @@ public class SoundcloudStreamUrlIdHandler implements UrlIdHandler { } @Override - public String getUrl(String videoId) throws ParsingException { + public String getUrl(String id) throws ParsingException { try { - return SoundcloudParsingHelper.resolveUrlWithEmbedPlayer("https://api.soundcloud.com/tracks/" + videoId); + return SoundcloudParsingHelper.resolveUrlWithEmbedPlayer("https://api.soundcloud.com/tracks/" + id); } catch (Exception e) { throw new ParsingException(e.getMessage(), e); } @@ -49,8 +49,8 @@ public class SoundcloudStreamUrlIdHandler implements UrlIdHandler { } @Override - public boolean acceptUrl(String videoUrl) { + public boolean acceptUrl(String url) { String regex = "^https?://(www\\.)?soundcloud.com/[0-9a-z_-]+/(?!(tracks|albums|sets|reposts|followers|following)/?$)[0-9a-z_-]+/?([#?].*)?$"; - return Parser.isMatch(regex, videoUrl.toLowerCase()); + return Parser.isMatch(regex, url.toLowerCase()); } } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudUserExtractor.java similarity index 69% rename from src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractor.java rename to src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudUserExtractor.java index e68d312f..2d602b96 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudUserExtractor.java @@ -4,19 +4,19 @@ import org.json.JSONObject; import org.schabi.newpipe.extractor.Downloader; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.StreamingService; -import org.schabi.newpipe.extractor.channel.ChannelExtractor; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.stream.StreamInfoItemCollector; +import org.schabi.newpipe.extractor.user.UserExtractor; import java.io.IOException; @SuppressWarnings("WeakerAccess") -public class SoundcloudChannelExtractor extends ChannelExtractor { - private String channelId; - private JSONObject channel; +public class SoundcloudUserExtractor extends UserExtractor { + private String userId; + private JSONObject user; - public SoundcloudChannelExtractor(StreamingService service, String url, String nextStreamsUrl) throws IOException, ExtractionException { + public SoundcloudUserExtractor(StreamingService service, String url, String nextStreamsUrl) throws IOException, ExtractionException { super(service, url, nextStreamsUrl); } @@ -24,42 +24,42 @@ public class SoundcloudChannelExtractor extends ChannelExtractor { public void fetchPage() throws IOException, ExtractionException { Downloader dl = NewPipe.getDownloader(); - channelId = getUrlIdHandler().getId(getOriginalUrl()); - String apiUrl = "https://api.soundcloud.com/users/" + channelId + + userId = getUrlIdHandler().getId(getOriginalUrl()); + String apiUrl = "https://api.soundcloud.com/users/" + userId + "?client_id=" + SoundcloudParsingHelper.clientId(); String response = dl.download(apiUrl); - channel = new JSONObject(response); + user = new JSONObject(response); } @Override public String getCleanUrl() { try { - return channel.getString("permalink_url"); + return user.getString("permalink_url"); } catch (Exception e) { return getOriginalUrl(); } } @Override - public String getChannelId() { - return channelId; + public String getUserId() { + return userId; } @Override - public String getChannelName() { - return channel.getString("username"); + public String getUserName() { + return user.getString("username"); } @Override public String getAvatarUrl() { - return channel.getString("avatar_url"); + return user.getString("avatar_url"); } @Override public String getBannerUrl() throws ParsingException { try { - return channel.getJSONObject("visuals").getJSONArray("visuals").getJSONObject(0).getString("visual_url"); + return user.getJSONObject("visuals").getJSONArray("visuals").getJSONObject(0).getString("visual_url"); } catch (Exception e) { throw new ParsingException("Could not get Banner", e); } @@ -67,7 +67,7 @@ public class SoundcloudChannelExtractor extends ChannelExtractor { @Override public long getSubscriberCount() { - return channel.getLong("followers_count"); + return user.getLong("followers_count"); } @Override @@ -79,7 +79,7 @@ public class SoundcloudChannelExtractor extends ChannelExtractor { public StreamInfoItemCollector getStreams() throws IOException, ExtractionException { StreamInfoItemCollector collector = new StreamInfoItemCollector(getServiceId()); - String apiUrl = "https://api-v2.soundcloud.com/users/" + getChannelId() + "/tracks" + String apiUrl = "https://api-v2.soundcloud.com/users/" + getUserId() + "/tracks" + "?client_id=" + SoundcloudParsingHelper.clientId() + "&limit=20" + "&linked_partitioning=1"; @@ -91,7 +91,7 @@ public class SoundcloudChannelExtractor extends ChannelExtractor { @Override public NextItemsResult getNextStreams() throws IOException, ExtractionException { if (!hasMoreStreams()) { - throw new ExtractionException("Channel doesn't have more streams"); + throw new ExtractionException("User doesn't have more streams"); } StreamInfoItemCollector collector = new StreamInfoItemCollector(getServiceId()); diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelInfoItemExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudUserInfoItemExtractor.java similarity index 75% rename from src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelInfoItemExtractor.java rename to src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudUserInfoItemExtractor.java index b676eb65..925dca73 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelInfoItemExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudUserInfoItemExtractor.java @@ -1,12 +1,12 @@ package org.schabi.newpipe.extractor.services.soundcloud; import org.json.JSONObject; -import org.schabi.newpipe.extractor.channel.ChannelInfoItemExtractor; +import org.schabi.newpipe.extractor.user.UserInfoItemExtractor; -public class SoundcloudChannelInfoItemExtractor implements ChannelInfoItemExtractor { +public class SoundcloudUserInfoItemExtractor implements UserInfoItemExtractor { private JSONObject searchResult; - public SoundcloudChannelInfoItemExtractor(JSONObject searchResult) { + public SoundcloudUserInfoItemExtractor(JSONObject searchResult) { this.searchResult = searchResult; } @@ -16,7 +16,7 @@ public class SoundcloudChannelInfoItemExtractor implements ChannelInfoItemExtrac } @Override - public String getChannelName() { + public String getUserName() { return searchResult.getString("username"); } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelUrlIdHandler.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudUserUrlIdHandler.java similarity index 74% rename from src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelUrlIdHandler.java rename to src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudUserUrlIdHandler.java index 4c96079c..40bbb8c1 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelUrlIdHandler.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudUserUrlIdHandler.java @@ -7,18 +7,18 @@ import org.schabi.newpipe.extractor.UrlIdHandler; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.utils.Parser; -public class SoundcloudChannelUrlIdHandler implements UrlIdHandler { +public class SoundcloudUserUrlIdHandler implements UrlIdHandler { - private static final SoundcloudChannelUrlIdHandler instance = new SoundcloudChannelUrlIdHandler(); + private static final SoundcloudUserUrlIdHandler instance = new SoundcloudUserUrlIdHandler(); - public static SoundcloudChannelUrlIdHandler getInstance() { + public static SoundcloudUserUrlIdHandler getInstance() { return instance; } @Override - public String getUrl(String channelId) throws ParsingException { + public String getUrl(String id) throws ParsingException { try { - return SoundcloudParsingHelper.resolveUrlWithEmbedPlayer("https://api.soundcloud.com/users/" + channelId); + return SoundcloudParsingHelper.resolveUrlWithEmbedPlayer("https://api.soundcloud.com/users/" + id); } catch (Exception e) { throw new ParsingException(e.getMessage(), e); } @@ -46,8 +46,8 @@ public class SoundcloudChannelUrlIdHandler implements UrlIdHandler { } @Override - public boolean acceptUrl(String channelUrl) { + public boolean acceptUrl(String url) { String regex = "^https?://(www\\.)?soundcloud.com/[0-9a-z_-]+(/((tracks|albums|sets|reposts|followers|following)/?)?)?([#?].*)?$"; - return Parser.isMatch(regex, channelUrl.toLowerCase()); + return Parser.isMatch(regex, url.toLowerCase()); } } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistUrlIdHandler.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistUrlIdHandler.java index d82e0ab1..74bcc086 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistUrlIdHandler.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistUrlIdHandler.java @@ -15,8 +15,8 @@ public class YoutubePlaylistUrlIdHandler implements UrlIdHandler { } @Override - public String getUrl(String listId) { - return "https://www.youtube.com/playlist?list=" + listId; + public String getUrl(String id) { + return "https://www.youtube.com/playlist?list=" + id; } @Override @@ -34,9 +34,9 @@ public class YoutubePlaylistUrlIdHandler implements UrlIdHandler { } @Override - public boolean acceptUrl(String videoUrl) { - final boolean hasNotEmptyUrl = videoUrl != null && !videoUrl.isEmpty(); - final boolean isYoutubeDomain = hasNotEmptyUrl && (videoUrl.contains("youtube") || videoUrl.contains("youtu.be")); - return isYoutubeDomain && videoUrl.contains("list="); + public boolean acceptUrl(String url) { + final boolean hasNotEmptyUrl = url != null && !url.isEmpty(); + final boolean isYoutubeDomain = hasNotEmptyUrl && (url.contains("youtube") || url.contains("youtu.be")); + return isYoutubeDomain && url.contains("list="); } } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java index 62beae1d..43f147a3 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngine.java @@ -57,9 +57,9 @@ public class YoutubeSearchEngine extends SearchEngine { String url = "https://www.youtube.com/results" + "?q=" + URLEncoder.encode(query, CHARSET_UTF_8) + "&page=" + Integer.toString(page + 1); - if (filter.contains(Filter.STREAM) && !filter.contains(Filter.CHANNEL)) { + if (filter.contains(Filter.STREAM) && !filter.contains(Filter.USER)) { url += "&sp=EgIQAQ%253D%253D"; - } else if (!filter.contains(Filter.STREAM) && filter.contains(Filter.CHANNEL)) { + } else if (!filter.contains(Filter.STREAM) && filter.contains(Filter.USER)) { url += "&sp=EgIQAg%253D%253D"; } @@ -104,7 +104,7 @@ public class YoutubeSearchEngine extends SearchEngine { } else if ((el = item.select("div[class*=\"yt-lockup-video\"]").first()) != null) { collector.commit(new YoutubeStreamInfoItemExtractor(el)); } else if ((el = item.select("div[class*=\"yt-lockup-channel\"]").first()) != null) { - collector.commit(new YoutubeChannelInfoItemExtractor(el)); + collector.commit(new YoutubeUserInfoItemExtractor(el)); } else { // noinspection ConstantConditions // simply ignore not known items diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java index eb892602..2f751d0a 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeService.java @@ -3,11 +3,11 @@ package org.schabi.newpipe.extractor.services.youtube; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.SuggestionExtractor; import org.schabi.newpipe.extractor.UrlIdHandler; -import org.schabi.newpipe.extractor.channel.ChannelExtractor; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; import org.schabi.newpipe.extractor.search.SearchEngine; import org.schabi.newpipe.extractor.stream.StreamExtractor; +import org.schabi.newpipe.extractor.user.UserExtractor; import java.io.IOException; @@ -49,8 +49,8 @@ public class YoutubeService extends StreamingService { } @Override - public UrlIdHandler getChannelUrlIdHandler() { - return YoutubeChannelUrlIdHandler.getInstance(); + public UrlIdHandler getUserUrlIdHandler() { + return YoutubeUserUrlIdHandler.getInstance(); } @Override @@ -65,8 +65,8 @@ public class YoutubeService extends StreamingService { } @Override - public ChannelExtractor getChannelExtractor(String url, String nextStreamsUrl) throws IOException, ExtractionException { - return new YoutubeChannelExtractor(this, url, nextStreamsUrl); + public UserExtractor getUserExtractor(String url, String nextStreamsUrl) throws IOException, ExtractionException { + return new YoutubeUserExtractor(this, url, nextStreamsUrl); } @Override diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java index 7fe23053..18ef2449 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java @@ -542,7 +542,7 @@ public class YoutubeStreamExtractor extends StreamExtractor { } @Override - public String getChannelUrl() throws ParsingException { + public String getUserUrl() throws ParsingException { try { return doc.select("div[class=\"yt-user-info\"]").first().children() .select("a").first().attr("abs:href"); diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUrlIdHandler.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUrlIdHandler.java index a6f62904..18f22ed1 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUrlIdHandler.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamUrlIdHandler.java @@ -47,8 +47,8 @@ public class YoutubeStreamUrlIdHandler implements UrlIdHandler { } @Override - public String getUrl(String videoId) { - return "https://www.youtube.com/watch?v=" + videoId; + public String getUrl(String id) { + return "https://www.youtube.com/watch?v=" + id; } @Override @@ -146,13 +146,13 @@ public class YoutubeStreamUrlIdHandler implements UrlIdHandler { } @Override - public boolean acceptUrl(String videoUrl) { - String lowercaseUrl = videoUrl.toLowerCase(); + public boolean acceptUrl(String url) { + String lowercaseUrl = url.toLowerCase(); if (lowercaseUrl.contains("youtube") || lowercaseUrl.contains("youtu.be")) { // bad programming I know try { - getId(videoUrl); + getId(url); return true; } catch (Exception e) { return false; diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserExtractor.java similarity index 96% rename from src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java rename to src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserExtractor.java index 29f71172..6d6d05aa 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserExtractor.java @@ -9,13 +9,13 @@ import org.jsoup.nodes.Element; import org.schabi.newpipe.extractor.Downloader; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.StreamingService; -import org.schabi.newpipe.extractor.channel.ChannelExtractor; 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.stream.StreamInfoItemCollector; import org.schabi.newpipe.extractor.stream.StreamInfoItemExtractor; import org.schabi.newpipe.extractor.stream.StreamType; +import org.schabi.newpipe.extractor.user.UserExtractor; import org.schabi.newpipe.extractor.utils.Parser; import org.schabi.newpipe.extractor.utils.Utils; @@ -25,7 +25,7 @@ import java.io.IOException; * Created by Christian Schabesberger on 25.07.16. * * Copyright (C) Christian Schabesberger 2016 - * YoutubeChannelExtractor.java is part of NewPipe. + * YoutubeUserExtractor.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 @@ -42,7 +42,7 @@ import java.io.IOException; */ @SuppressWarnings("WeakerAccess") -public class YoutubeChannelExtractor extends ChannelExtractor { +public class YoutubeUserExtractor extends UserExtractor { private static final String CHANNEL_FEED_BASE = "https://www.youtube.com/feeds/videos.xml?channel_id="; private static final String CHANNEL_URL_PARAMETERS = "/videos?view=0&flow=list&sort=dd&live_view=10000"; @@ -52,7 +52,7 @@ public class YoutubeChannelExtractor extends ChannelExtractor { */ private Document nextStreamsAjax; - public YoutubeChannelExtractor(StreamingService service, String url, String nextStreamsUrl) throws IOException, ExtractionException { + public YoutubeUserExtractor(StreamingService service, String url, String nextStreamsUrl) throws IOException, ExtractionException { super(service, url, nextStreamsUrl); } @@ -69,7 +69,7 @@ public class YoutubeChannelExtractor extends ChannelExtractor { } @Override - public String getChannelId() throws ParsingException { + public String getUserId() throws ParsingException { try { return getUrlIdHandler().getId(getCleanUrl()); } catch (Exception e) { @@ -78,7 +78,7 @@ public class YoutubeChannelExtractor extends ChannelExtractor { } @Override - public String getChannelName() throws ParsingException { + public String getUserName() throws ParsingException { try { return doc.select("span[class=\"qualified-channel-title-text\"]").first().select("a").first().text(); } catch (Exception e) { @@ -239,7 +239,7 @@ public class YoutubeChannelExtractor extends ChannelExtractor { @Override public String getUploader() throws ParsingException { - return getChannelName(); + return getUserName(); } @Override diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelInfoItemExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserInfoItemExtractor.java similarity index 88% rename from src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelInfoItemExtractor.java rename to src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserInfoItemExtractor.java index 7151a33b..a509f1a4 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelInfoItemExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserInfoItemExtractor.java @@ -1,15 +1,15 @@ package org.schabi.newpipe.extractor.services.youtube; import org.jsoup.nodes.Element; -import org.schabi.newpipe.extractor.channel.ChannelInfoItemExtractor; import org.schabi.newpipe.extractor.exceptions.ParsingException; +import org.schabi.newpipe.extractor.user.UserInfoItemExtractor; import org.schabi.newpipe.extractor.utils.Utils; /* * Created by Christian Schabesberger on 12.02.17. * * Copyright (C) Christian Schabesberger 2017 - * YoutubeChannelInfoItemExtractor.java is part of NewPipe. + * YoutubeUserInfoItemExtractor.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 @@ -25,10 +25,10 @@ import org.schabi.newpipe.extractor.utils.Utils; * along with NewPipe. If not, see . */ -public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor { +public class YoutubeUserInfoItemExtractor implements UserInfoItemExtractor { private Element el; - public YoutubeChannelInfoItemExtractor(Element el) { + public YoutubeUserInfoItemExtractor(Element el) { this.el = el; } @@ -46,7 +46,7 @@ public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor } @Override - public String getChannelName() throws ParsingException { + public String getUserName() throws ParsingException { return el.select("a[class*=\"yt-uix-tile-link\"]").first() .text(); } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelUrlIdHandler.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserUrlIdHandler.java similarity index 58% rename from src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelUrlIdHandler.java rename to src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserUrlIdHandler.java index e1d103fe..657722d4 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelUrlIdHandler.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserUrlIdHandler.java @@ -8,7 +8,7 @@ import org.schabi.newpipe.extractor.utils.Parser; * Created by Christian Schabesberger on 25.07.16. * * Copyright (C) Christian Schabesberger 2016 - * YoutubeChannelUrlIdHandler.java is part of NewPipe. + * YoutubeUserUrlIdHandler.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 @@ -24,35 +24,35 @@ import org.schabi.newpipe.extractor.utils.Parser; * along with NewPipe. If not, see . */ -public class YoutubeChannelUrlIdHandler implements UrlIdHandler { +public class YoutubeUserUrlIdHandler implements UrlIdHandler { - private static final YoutubeChannelUrlIdHandler instance = new YoutubeChannelUrlIdHandler(); + private static final YoutubeUserUrlIdHandler instance = new YoutubeUserUrlIdHandler(); private static final String ID_PATTERN = "/(user/[A-Za-z0-9_-]*|channel/[A-Za-z0-9_-]*)"; - public static YoutubeChannelUrlIdHandler getInstance() { + public static YoutubeUserUrlIdHandler getInstance() { return instance; } @Override - public String getUrl(String channelId) { - return "https://www.youtube.com/" + channelId; + public String getUrl(String id) { + return "https://www.youtube.com/" + id; } @Override - public String getId(String siteUrl) throws ParsingException { - return Parser.matchGroup1(ID_PATTERN, siteUrl); + public String getId(String url) throws ParsingException { + return Parser.matchGroup1(ID_PATTERN, url); } @Override - public String cleanUrl(String siteUrl) throws ParsingException { - return getUrl(getId(siteUrl)); + public String cleanUrl(String complexUrl) throws ParsingException { + return getUrl(getId(complexUrl)); } @Override - public boolean acceptUrl(String videoUrl) { - return (videoUrl.contains("youtube") || - videoUrl.contains("youtu.be")) && - (videoUrl.contains("/user/") || - videoUrl.contains("/channel/")); + public boolean acceptUrl(String url) { + return (url.contains("youtube") || + url.contains("youtu.be")) && + (url.contains("/user/") || + url.contains("/channel/")); } } diff --git a/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java b/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java index c70ad36d..2a236c14 100644 --- a/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java @@ -49,7 +49,7 @@ public abstract class StreamExtractor extends Extractor { public abstract String getTitle() throws ParsingException; public abstract String getDescription() throws ParsingException; public abstract String getUploader() throws ParsingException; - public abstract String getChannelUrl() throws ParsingException; + public abstract String getUserUrl() throws ParsingException; public abstract int getLength() throws ParsingException; public abstract long getViewCount() throws ParsingException; public abstract String getUploadDate() throws ParsingException; diff --git a/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfo.java b/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfo.java index 2e0242ea..70537e58 100644 --- a/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfo.java +++ b/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfo.java @@ -195,7 +195,7 @@ public class StreamInfo extends Info { streamInfo.addException(e); } try { - streamInfo.channel_url = extractor.getChannelUrl(); + streamInfo.user_url = extractor.getUserUrl(); } catch (Exception e) { streamInfo.addException(e); } @@ -275,7 +275,7 @@ public class StreamInfo extends Info { public long view_count = -1; public String uploader_thumbnail_url; - public String channel_url; + public String user_url; public String description; public List video_streams; diff --git a/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java b/src/main/java/org/schabi/newpipe/extractor/user/UserExtractor.java similarity index 76% rename from src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java rename to src/main/java/org/schabi/newpipe/extractor/user/UserExtractor.java index bdcad452..703ff97e 100644 --- a/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/user/UserExtractor.java @@ -1,4 +1,4 @@ -package org.schabi.newpipe.extractor.channel; +package org.schabi.newpipe.extractor.user; import org.schabi.newpipe.extractor.ListExtractor; import org.schabi.newpipe.extractor.StreamingService; @@ -12,7 +12,7 @@ import java.io.IOException; * Created by Christian Schabesberger on 25.07.16. * * Copyright (C) Christian Schabesberger 2016 - * ChannelExtractor.java is part of NewPipe. + * UserExtractor.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 @@ -28,19 +28,19 @@ import java.io.IOException; * along with NewPipe. If not, see . */ -public abstract class ChannelExtractor extends ListExtractor { +public abstract class UserExtractor extends ListExtractor { - public ChannelExtractor(StreamingService service, String url, String nextStreamsUrl) throws IOException, ExtractionException { + public UserExtractor(StreamingService service, String url, String nextStreamsUrl) throws IOException, ExtractionException { super(service, url, nextStreamsUrl); } @Override protected UrlIdHandler getUrlIdHandler() throws ParsingException { - return getService().getChannelUrlIdHandler(); + return getService().getUserUrlIdHandler(); } - public abstract String getChannelId() throws ParsingException; - public abstract String getChannelName() throws ParsingException; + public abstract String getUserId() throws ParsingException; + public abstract String getUserName() throws ParsingException; public abstract String getAvatarUrl() throws ParsingException; public abstract String getBannerUrl() throws ParsingException; public abstract String getFeedUrl() throws ParsingException; diff --git a/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java b/src/main/java/org/schabi/newpipe/extractor/user/UserInfo.java similarity index 79% rename from src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java rename to src/main/java/org/schabi/newpipe/extractor/user/UserInfo.java index 47473de2..1b0fffa6 100644 --- a/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java +++ b/src/main/java/org/schabi/newpipe/extractor/user/UserInfo.java @@ -1,4 +1,4 @@ -package org.schabi.newpipe.extractor.channel; +package org.schabi.newpipe.extractor.user; import org.schabi.newpipe.extractor.ListExtractor.NextItemsResult; import org.schabi.newpipe.extractor.ListInfo; @@ -16,7 +16,7 @@ import java.util.ArrayList; * Created by Christian Schabesberger on 31.07.16. * * Copyright (C) Christian Schabesberger 2016 - * ChannelInfo.java is part of NewPipe. + * UserInfo.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 @@ -32,36 +32,36 @@ import java.util.ArrayList; * along with NewPipe. If not, see . */ -public class ChannelInfo extends ListInfo { +public class UserInfo extends ListInfo { public static NextItemsResult getMoreItems(ServiceList serviceItem, String nextStreamsUrl) throws IOException, ExtractionException { return getMoreItems(serviceItem.getService(), nextStreamsUrl); } public static NextItemsResult getMoreItems(StreamingService service, String nextStreamsUrl) throws IOException, ExtractionException { - return service.getChannelExtractor(null, nextStreamsUrl).getNextStreams(); + return service.getUserExtractor(null, nextStreamsUrl).getNextStreams(); } - public static ChannelInfo getInfo(String url) throws IOException, ExtractionException { + public static UserInfo getInfo(String url) throws IOException, ExtractionException { return getInfo(NewPipe.getServiceByUrl(url), url); } - public static ChannelInfo getInfo(ServiceList serviceItem, String url) throws IOException, ExtractionException { + public static UserInfo getInfo(ServiceList serviceItem, String url) throws IOException, ExtractionException { return getInfo(serviceItem.getService(), url); } - public static ChannelInfo getInfo(StreamingService service, String url) throws IOException, ExtractionException { - return getInfo(service.getChannelExtractor(url)); + public static UserInfo getInfo(StreamingService service, String url) throws IOException, ExtractionException { + return getInfo(service.getUserExtractor(url)); } - public static ChannelInfo getInfo(ChannelExtractor extractor) throws ParsingException { - ChannelInfo info = new ChannelInfo(); + public static UserInfo getInfo(UserExtractor extractor) throws ParsingException { + UserInfo info = new UserInfo(); // important data info.service_id = extractor.getServiceId(); info.url = extractor.getCleanUrl(); - info.id = extractor.getChannelId(); - info.name = extractor.getChannelName(); + info.id = extractor.getUserId(); + info.name = extractor.getUserName(); try { info.avatar_url = extractor.getAvatarUrl(); diff --git a/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItem.java b/src/main/java/org/schabi/newpipe/extractor/user/UserInfoItem.java similarity index 82% rename from src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItem.java rename to src/main/java/org/schabi/newpipe/extractor/user/UserInfoItem.java index e0ff5a4d..a5d1d13e 100644 --- a/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItem.java +++ b/src/main/java/org/schabi/newpipe/extractor/user/UserInfoItem.java @@ -1,4 +1,4 @@ -package org.schabi.newpipe.extractor.channel; +package org.schabi.newpipe.extractor.user; import org.schabi.newpipe.extractor.InfoItem; @@ -6,7 +6,7 @@ import org.schabi.newpipe.extractor.InfoItem; * Created by Christian Schabesberger on 11.02.17. * * Copyright (C) Christian Schabesberger 2017 - * ChannelInfoItem.java is part of NewPipe. + * UserInfoItem.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 @@ -22,14 +22,14 @@ import org.schabi.newpipe.extractor.InfoItem; * along with NewPipe. If not, see . */ -public class ChannelInfoItem extends InfoItem { +public class UserInfoItem extends InfoItem { public String thumbnail_url; public String description; public long subscriber_count = -1; public long stream_count = -1; - public ChannelInfoItem() { - super(InfoType.CHANNEL); + public UserInfoItem() { + super(InfoType.USER); } } diff --git a/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemCollector.java b/src/main/java/org/schabi/newpipe/extractor/user/UserInfoItemCollector.java similarity index 78% rename from src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemCollector.java rename to src/main/java/org/schabi/newpipe/extractor/user/UserInfoItemCollector.java index 8e8c45d2..69e78fe5 100644 --- a/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemCollector.java +++ b/src/main/java/org/schabi/newpipe/extractor/user/UserInfoItemCollector.java @@ -1,4 +1,4 @@ -package org.schabi.newpipe.extractor.channel; +package org.schabi.newpipe.extractor.user; import org.schabi.newpipe.extractor.InfoItemCollector; import org.schabi.newpipe.extractor.exceptions.ParsingException; @@ -7,7 +7,7 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException; * Created by Christian Schabesberger on 12.02.17. * * Copyright (C) Christian Schabesberger 2017 - * ChannelInfoItemCollector.java is part of NewPipe. + * UserInfoItemCollector.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,15 +23,15 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException; * along with NewPipe. If not, see . */ -public class ChannelInfoItemCollector extends InfoItemCollector { - public ChannelInfoItemCollector(int serviceId) { +public class UserInfoItemCollector extends InfoItemCollector { + public UserInfoItemCollector(int serviceId) { super(serviceId); } - public ChannelInfoItem extract(ChannelInfoItemExtractor extractor) throws ParsingException { - ChannelInfoItem resultItem = new ChannelInfoItem(); + public UserInfoItem extract(UserInfoItemExtractor extractor) throws ParsingException { + UserInfoItem resultItem = new UserInfoItem(); // important information - resultItem.name = extractor.getChannelName(); + resultItem.name = extractor.getUserName(); resultItem.service_id = getServiceId(); resultItem.url = extractor.getWebPageUrl(); @@ -60,7 +60,7 @@ public class ChannelInfoItemCollector extends InfoItemCollector { return resultItem; } - public void commit(ChannelInfoItemExtractor extractor) throws ParsingException { + public void commit(UserInfoItemExtractor extractor) throws ParsingException { try { addItem(extract(extractor)); } catch (Exception e) { diff --git a/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemExtractor.java b/src/main/java/org/schabi/newpipe/extractor/user/UserInfoItemExtractor.java similarity index 84% rename from src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemExtractor.java rename to src/main/java/org/schabi/newpipe/extractor/user/UserInfoItemExtractor.java index 5f22ca7a..925368ea 100644 --- a/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfoItemExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/user/UserInfoItemExtractor.java @@ -1,4 +1,4 @@ -package org.schabi.newpipe.extractor.channel; +package org.schabi.newpipe.extractor.user; import org.schabi.newpipe.extractor.exceptions.ParsingException; @@ -6,7 +6,7 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException; * Created by Christian Schabesberger on 12.02.17. * * Copyright (C) Christian Schabesberger 2017 - * ChannelInfoItemExtractor.java is part of NewPipe. + * UserInfoItemExtractor.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 @@ -22,9 +22,9 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException; * along with NewPipe. If not, see . */ -public interface ChannelInfoItemExtractor { +public interface UserInfoItemExtractor { String getThumbnailUrl() throws ParsingException; - String getChannelName() throws ParsingException; + String getUserName() throws ParsingException; String getWebPageUrl() throws ParsingException; String getDescription() throws ParsingException; long getSubscriberCount() throws ParsingException; diff --git a/src/test/java/org/schabi/newpipe/extractor/NewPipeTest.java b/src/test/java/org/schabi/newpipe/extractor/NewPipeTest.java index 1c59e76f..294badec 100644 --- a/src/test/java/org/schabi/newpipe/extractor/NewPipeTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/NewPipeTest.java @@ -8,7 +8,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import static org.schabi.newpipe.extractor.ServiceList.SoundCloud; -import static org.schabi.newpipe.extractor.ServiceList.Youtube; +import static org.schabi.newpipe.extractor.ServiceList.YouTube; import static org.schabi.newpipe.extractor.NewPipe.getServiceByUrl; public class NewPipeTest { @@ -29,46 +29,46 @@ public class NewPipeTest { @Test public void getServiceWithId() throws Exception { - assertEquals(NewPipe.getService(Youtube.getId()), Youtube.getService()); + assertEquals(NewPipe.getService(YouTube.getId()), YouTube.getService()); assertEquals(NewPipe.getService(SoundCloud.getId()), SoundCloud.getService()); - assertNotEquals(NewPipe.getService(SoundCloud.getId()), Youtube.getService()); + assertNotEquals(NewPipe.getService(SoundCloud.getId()), YouTube.getService()); } @Test public void getServiceWithName() throws Exception { - assertEquals(NewPipe.getService(Youtube.getServiceInfo().name), Youtube.getService()); + assertEquals(NewPipe.getService(YouTube.getServiceInfo().name), YouTube.getService()); assertEquals(NewPipe.getService(SoundCloud.getServiceInfo().name), SoundCloud.getService()); - assertNotEquals(NewPipe.getService(Youtube.getServiceInfo().name), SoundCloud.getService()); + assertNotEquals(NewPipe.getService(YouTube.getServiceInfo().name), SoundCloud.getService()); } @Test public void getServiceWithUrl() throws Exception { - assertEquals(getServiceByUrl("https://www.youtube.com/watch?v=_r6CgaFNAGg"), Youtube.getService()); - assertEquals(getServiceByUrl("https://www.youtube.com/channel/UCi2bIyFtz-JdI-ou8kaqsqg"), Youtube.getService()); - assertEquals(getServiceByUrl("https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH"), Youtube.getService()); + assertEquals(getServiceByUrl("https://www.youtube.com/watch?v=_r6CgaFNAGg"), YouTube.getService()); + assertEquals(getServiceByUrl("https://www.youtube.com/channel/UCi2bIyFtz-JdI-ou8kaqsqg"), YouTube.getService()); + assertEquals(getServiceByUrl("https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH"), YouTube.getService()); assertEquals(getServiceByUrl("https://soundcloud.com/shupemoosic/pegboard-nerds-try-this"), SoundCloud.getService()); assertEquals(getServiceByUrl("https://soundcloud.com/deluxe314/sets/pegboard-nerds"), SoundCloud.getService()); assertEquals(getServiceByUrl("https://soundcloud.com/pegboardnerds"), SoundCloud.getService()); - assertNotEquals(getServiceByUrl("https://soundcloud.com/pegboardnerds"), Youtube.getService()); + assertNotEquals(getServiceByUrl("https://soundcloud.com/pegboardnerds"), YouTube.getService()); assertNotEquals(getServiceByUrl("https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH"), SoundCloud.getService()); } @Test public void getIdWithServiceName() throws Exception { - assertEquals(NewPipe.getIdOfService(Youtube.getServiceInfo().name), Youtube.getId()); + assertEquals(NewPipe.getIdOfService(YouTube.getServiceInfo().name), YouTube.getId()); assertEquals(NewPipe.getIdOfService(SoundCloud.getServiceInfo().name), SoundCloud.getId()); - assertNotEquals(NewPipe.getIdOfService(SoundCloud.getServiceInfo().name), Youtube.getId()); + assertNotEquals(NewPipe.getIdOfService(SoundCloud.getServiceInfo().name), YouTube.getId()); } @Test public void getServiceNameWithId() throws Exception { - assertEquals(NewPipe.getNameOfService(Youtube.getId()), Youtube.getServiceInfo().name); + assertEquals(NewPipe.getNameOfService(YouTube.getId()), YouTube.getServiceInfo().name); assertEquals(NewPipe.getNameOfService(SoundCloud.getId()), SoundCloud.getServiceInfo().name); - assertNotEquals(NewPipe.getNameOfService(Youtube.getId()), SoundCloud.getServiceInfo().name); + assertNotEquals(NewPipe.getNameOfService(YouTube.getId()), SoundCloud.getServiceInfo().name); } } diff --git a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java index 45fc46d1..83034870 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractorTest.java @@ -9,7 +9,7 @@ import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.schabi.newpipe.extractor.ServiceList.Youtube; +import static org.schabi.newpipe.extractor.ServiceList.YouTube; /** * Test for {@link PlaylistExtractor} @@ -21,7 +21,7 @@ public class YoutubePlaylistExtractorTest { @Before public void setUp() throws Exception { NewPipe.init(Downloader.getInstance()); - extractor = Youtube.getService() + extractor = YouTube.getService() .getPlaylistExtractor("https://www.youtube.com/playlist?list=PL7XlqX4npddfrdpMCxBnNZXg2GFll7t5y"); } diff --git a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineAllTest.java b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineAllTest.java index e18c0830..8f80f72c 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineAllTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineAllTest.java @@ -11,7 +11,7 @@ import java.util.EnumSet; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import static org.schabi.newpipe.extractor.ServiceList.Youtube; +import static org.schabi.newpipe.extractor.ServiceList.YouTube; /* @@ -43,12 +43,12 @@ public class YoutubeSearchEngineAllTest { @Before public void setUp() throws Exception { NewPipe.init(Downloader.getInstance()); - SearchEngine engine = Youtube.getService().getSearchEngine(); + SearchEngine engine = YouTube.getService().getSearchEngine(); // Youtube will suggest "asdf" instead of "asdgff" // keep in mind that the suggestions can change by country (the parameter "de") result = engine.search("asdgff", 0, "de", - EnumSet.of(SearchEngine.Filter.CHANNEL, + EnumSet.of(SearchEngine.Filter.USER, SearchEngine.Filter.STREAM)).getSearchResult(); } diff --git a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineStreamTest.java b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineStreamTest.java index da67ea76..3cf94ce1 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineStreamTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineStreamTest.java @@ -14,7 +14,7 @@ import java.util.EnumSet; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import static org.schabi.newpipe.extractor.ServiceList.Youtube; +import static org.schabi.newpipe.extractor.ServiceList.YouTube; /* @@ -46,7 +46,7 @@ public class YoutubeSearchEngineStreamTest { @Before public void setUp() throws Exception { NewPipe.init(Downloader.getInstance()); - SearchEngine engine = Youtube.getService().getSearchEngine(); + SearchEngine engine = YouTube.getService().getSearchEngine(); // Youtube will suggest "results" instead of "rsults", // keep in mind that the suggestions can change by country (the parameter "de") diff --git a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineChannelTest.java b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineUserTest.java similarity index 86% rename from src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineChannelTest.java rename to src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineUserTest.java index 868b2b83..01b2b298 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineChannelTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSearchEngineUserTest.java @@ -13,7 +13,7 @@ import java.util.EnumSet; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import static org.schabi.newpipe.extractor.ServiceList.Youtube; +import static org.schabi.newpipe.extractor.ServiceList.YouTube; /* @@ -39,18 +39,18 @@ import static org.schabi.newpipe.extractor.ServiceList.Youtube; /** * Test for {@link SearchEngine} */ -public class YoutubeSearchEngineChannelTest { +public class YoutubeSearchEngineUserTest { private SearchResult result; @Before public void setUp() throws Exception { NewPipe.init(Downloader.getInstance()); - SearchEngine engine = Youtube.getService().getSearchEngine(); + SearchEngine engine = YouTube.getService().getSearchEngine(); // Youtube will suggest "gronkh" instead of "grrunkh" // keep in mind that the suggestions can change by country (the parameter "de") result = engine.search("grrunkh", 0, "de", - EnumSet.of(SearchEngine.Filter.CHANNEL)).getSearchResult(); + EnumSet.of(SearchEngine.Filter.USER)).getSearchResult(); } @Test @@ -59,9 +59,9 @@ public class YoutubeSearchEngineChannelTest { } @Test - public void testChannelItemType() { + public void testUserItemType() { for (InfoItem infoItem : result.resultList) { - assertEquals(InfoItem.InfoType.CHANNEL, infoItem.info_type); + assertEquals(InfoItem.InfoType.USER, infoItem.info_type); } } diff --git a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorDefaultTest.java b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorDefaultTest.java index 8c3976e3..b3c2b297 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorDefaultTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorDefaultTest.java @@ -15,7 +15,7 @@ import java.io.IOException; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import static org.schabi.newpipe.extractor.ServiceList.Youtube; +import static org.schabi.newpipe.extractor.ServiceList.YouTube; /* * Created by Christian Schabesberger on 30.12.15. @@ -47,7 +47,7 @@ public class YoutubeStreamExtractorDefaultTest { @Before public void setUp() throws Exception { NewPipe.init(Downloader.getInstance()); - extractor = Youtube.getService().getStreamExtractor("https://www.youtube.com/watch?v=YQHsXMglC9A"); + extractor = YouTube.getService().getStreamExtractor("https://www.youtube.com/watch?v=YQHsXMglC9A"); } @Test @@ -58,7 +58,7 @@ public class YoutubeStreamExtractorDefaultTest { @Test public void testGetValidTimeStamp() throws IOException, ExtractionException { - StreamExtractor extractor = Youtube.getService().getStreamExtractor("https://youtu.be/FmG385_uUys?t=174"); + StreamExtractor extractor = YouTube.getService().getStreamExtractor("https://youtu.be/FmG385_uUys?t=174"); assertTrue(Integer.toString(extractor.getTimeStamp()), extractor.getTimeStamp() == 174); } @@ -95,8 +95,8 @@ public class YoutubeStreamExtractorDefaultTest { } @Test - public void testGetChannelUrl() throws ParsingException { - assertTrue(extractor.getChannelUrl().length() > 0); + public void testGetUserlUrl() throws ParsingException { + assertTrue(extractor.getUserUrl().length() > 0); } @Test diff --git a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorGemaTest.java b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorGemaTest.java index ba164e80..47d0aa8b 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorGemaTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorGemaTest.java @@ -9,7 +9,7 @@ import org.schabi.newpipe.extractor.exceptions.ExtractionException; import java.io.IOException; import static org.junit.Assert.fail; -import static org.schabi.newpipe.extractor.ServiceList.Youtube; +import static org.schabi.newpipe.extractor.ServiceList.YouTube; /* * Created by Christian Schabesberger on 30.12.15. @@ -43,7 +43,7 @@ public class YoutubeStreamExtractorGemaTest { public void testGemaError() throws IOException, ExtractionException { try { NewPipe.init(Downloader.getInstance()); - Youtube.getService().getStreamExtractor("https://www.youtube.com/watch?v=3O1_3zBUKM8"); + YouTube.getService().getStreamExtractor("https://www.youtube.com/watch?v=3O1_3zBUKM8"); fail("GemaException should be thrown"); } catch (YoutubeStreamExtractor.GemaException ignored) { diff --git a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorRestrictedTest.java b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorRestrictedTest.java index 862eaa48..610c8d2e 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorRestrictedTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorRestrictedTest.java @@ -12,7 +12,7 @@ import org.schabi.newpipe.extractor.stream.VideoStream; import java.io.IOException; import static org.junit.Assert.assertTrue; -import static org.schabi.newpipe.extractor.ServiceList.Youtube; +import static org.schabi.newpipe.extractor.ServiceList.YouTube; /** * Test for {@link YoutubeStreamUrlIdHandler} @@ -24,7 +24,7 @@ public class YoutubeStreamExtractorRestrictedTest { @Before public void setUp() throws Exception { NewPipe.init(Downloader.getInstance()); - extractor = Youtube.getService() + extractor = YouTube.getService() .getStreamExtractor("https://www.youtube.com/watch?v=i6JTvzrpBy0"); } @@ -36,7 +36,7 @@ public class YoutubeStreamExtractorRestrictedTest { @Test public void testGetValidTimeStamp() throws IOException, ExtractionException { - StreamExtractor extractor= Youtube.getService() + StreamExtractor extractor= YouTube.getService() .getStreamExtractor("https://youtu.be/FmG385_uUys?t=174"); assertTrue(Integer.toString(extractor.getTimeStamp()), extractor.getTimeStamp() == 174); diff --git a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSuggestionExtractorTest.java b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSuggestionExtractorTest.java index c47828ab..58089081 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSuggestionExtractorTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeSuggestionExtractorTest.java @@ -10,7 +10,7 @@ import org.schabi.newpipe.extractor.exceptions.ExtractionException; import java.io.IOException; import static org.junit.Assert.assertFalse; -import static org.schabi.newpipe.extractor.ServiceList.Youtube; +import static org.schabi.newpipe.extractor.ServiceList.YouTube; /* * Created by Christian Schabesberger on 18.11.16. @@ -41,7 +41,7 @@ public class YoutubeSuggestionExtractorTest { @Before public void setUp() throws Exception { NewPipe.init(Downloader.getInstance()); - suggestionExtractor = Youtube.getService().getSuggestionExtractor(); + suggestionExtractor = YouTube.getService().getSuggestionExtractor(); } @Test diff --git a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserExtractorTest.java similarity index 85% rename from src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java rename to src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserExtractorTest.java index 3c98a5a2..8051922c 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserExtractorTest.java @@ -4,12 +4,12 @@ import org.junit.Before; import org.junit.Test; import org.schabi.newpipe.Downloader; import org.schabi.newpipe.extractor.NewPipe; -import org.schabi.newpipe.extractor.channel.ChannelExtractor; +import org.schabi.newpipe.extractor.user.UserExtractor; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.schabi.newpipe.extractor.ServiceList.Youtube; +import static org.schabi.newpipe.extractor.ServiceList.YouTube; /* * Created by Christian Schabesberger on 12.09.16. @@ -32,18 +32,18 @@ import static org.schabi.newpipe.extractor.ServiceList.Youtube; */ /** - * Test for {@link ChannelExtractor} + * Test for {@link UserExtractor} */ -public class YoutubeChannelExtractorTest { +public class YoutubeUserExtractorTest { - ChannelExtractor extractor; + UserExtractor extractor; @Before public void setUp() throws Exception { NewPipe.init(Downloader.getInstance()); - extractor = Youtube.getService() - .getChannelExtractor("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw"); + extractor = YouTube.getService() + .getUserExtractor("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw"); } @Test @@ -52,8 +52,8 @@ public class YoutubeChannelExtractorTest { } @Test - public void testGetChannelName() throws Exception { - assertEquals(extractor.getChannelName(), "Gronkh"); + public void testGetUserName() throws Exception { + assertEquals(extractor.getUserName(), "Gronkh"); } @Test