diff --git a/src/main/java/org/schabi/newpipe/extractor/InfoItem.java b/src/main/java/org/schabi/newpipe/extractor/InfoItem.java index 1c132e8cf..2c5a6f46c 100644 --- a/src/main/java/org/schabi/newpipe/extractor/InfoItem.java +++ b/src/main/java/org/schabi/newpipe/extractor/InfoItem.java @@ -29,11 +29,12 @@ public abstract class InfoItem implements Serializable { USER } + public final InfoType info_type; + public InfoItem(InfoType infoType) { this.info_type = infoType; } - public final InfoType info_type; public int service_id = -1; public String url; public String name; diff --git a/src/main/java/org/schabi/newpipe/extractor/MediaFormat.java b/src/main/java/org/schabi/newpipe/extractor/MediaFormat.java index 9c2ed4c43..86322a34d 100644 --- a/src/main/java/org/schabi/newpipe/extractor/MediaFormat.java +++ b/src/main/java/org/schabi/newpipe/extractor/MediaFormat.java @@ -38,9 +38,7 @@ public enum MediaFormat { MP3 (0x5, "MP3", "mp3", "audio/mpeg"); public final int id; - @SuppressWarnings("WeakerAccess") public final String name; - @SuppressWarnings("WeakerAccess") public final String suffix; public final String mimeType; diff --git a/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItem.java b/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItem.java index d49521586..0ef639048 100644 --- a/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItem.java +++ b/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItem.java @@ -4,6 +4,7 @@ import org.schabi.newpipe.extractor.InfoItem; public class PlaylistInfoItem extends InfoItem { + public String uploader_name; public String thumbnail_url; /** * How many streams this playlist have diff --git a/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItemCollector.java b/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItemCollector.java index 6ad2e1509..ee877976d 100644 --- a/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItemCollector.java +++ b/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItemCollector.java @@ -15,6 +15,11 @@ public class PlaylistInfoItemCollector extends InfoItemCollector { resultItem.service_id = getServiceId(); resultItem.url = extractor.getWebPageUrl(); + try { + resultItem.uploader_name = extractor.getUploaderName(); + } catch (Exception e) { + addError(e); + } try { resultItem.thumbnail_url = extractor.getThumbnailUrl(); } catch (Exception e) { diff --git a/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItemExtractor.java b/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItemExtractor.java index a97a1a33f..a8be9e13c 100644 --- a/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItemExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItemExtractor.java @@ -4,6 +4,7 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException; public interface PlaylistInfoItemExtractor { String getThumbnailUrl() throws ParsingException; + String getUploaderName() throws ParsingException; String getPlaylistName() throws ParsingException; String getWebPageUrl() throws ParsingException; long getStreamCount() throws ParsingException; diff --git a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamInfoItemExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamInfoItemExtractor.java index d2bb1383b..732622252 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamInfoItemExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamInfoItemExtractor.java @@ -29,7 +29,7 @@ public class SoundcloudStreamInfoItemExtractor implements StreamInfoItemExtracto } @Override - public String getUploader() { + public String getUploaderName() { return searchResult.getJSONObject("user").getString("username"); } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractor.java index 36750f1d2..b3c1ce98b 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractor.java @@ -239,7 +239,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor { } @Override - public String getUploader() throws ParsingException { + public String getUploaderName() throws ParsingException { return li.select("div[class=pl-video-owner] a").text(); } 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 8db32e2b3..6b30255c9 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 @@ -829,7 +829,7 @@ public class YoutubeStreamExtractor extends StreamExtractor { } @Override - public String getUploader() throws ParsingException { + public String getUploaderName() throws ParsingException { return li.select("span.g-hovercard").first().text(); } diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamInfoItemExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamInfoItemExtractor.java index aa1fffc10..c895c3c28 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamInfoItemExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamInfoItemExtractor.java @@ -71,7 +71,7 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor { } @Override - public String getUploader() throws ParsingException { + public String getUploaderName() throws ParsingException { try { return item.select("div[class=\"yt-lockup-byline\"]").first() .select("a").first() diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserExtractor.java index a22b75a73..7efec4453 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserExtractor.java @@ -247,7 +247,7 @@ public class YoutubeUserExtractor extends UserExtractor { } @Override - public String getUploader() throws ParsingException { + public String getUploaderName() throws ParsingException { return getUserName(); } diff --git a/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItem.java b/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItem.java index 9568cad89..f89d6bf23 100644 --- a/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItem.java +++ b/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItem.java @@ -28,7 +28,7 @@ import org.schabi.newpipe.extractor.InfoItem; public class StreamInfoItem extends InfoItem { public StreamType stream_type; - public String uploader; + public String uploader_name; public String thumbnail_url; public String upload_date; public long view_count = -1; diff --git a/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemCollector.java b/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemCollector.java index 12f0f4071..68d87b54c 100644 --- a/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemCollector.java +++ b/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemCollector.java @@ -50,7 +50,7 @@ public class StreamInfoItemCollector extends InfoItemCollector { addError(e); } try { - resultItem.uploader = extractor.getUploader(); + resultItem.uploader_name = extractor.getUploaderName(); } catch (Exception e) { addError(e); } diff --git a/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemExtractor.java b/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemExtractor.java index a635d907e..4ad1500d4 100644 --- a/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfoItemExtractor.java @@ -27,7 +27,7 @@ public interface StreamInfoItemExtractor { String getWebPageUrl() throws ParsingException; String getTitle() throws ParsingException; int getDuration() throws ParsingException; - String getUploader() throws ParsingException; + String getUploaderName() throws ParsingException; String getUploadDate() throws ParsingException; long getViewCount() throws ParsingException; String getThumbnailUrl() throws ParsingException; diff --git a/src/main/java/org/schabi/newpipe/extractor/user/UserInfoItemCollector.java b/src/main/java/org/schabi/newpipe/extractor/user/UserInfoItemCollector.java index 69e78fe58..443d96092 100644 --- a/src/main/java/org/schabi/newpipe/extractor/user/UserInfoItemCollector.java +++ b/src/main/java/org/schabi/newpipe/extractor/user/UserInfoItemCollector.java @@ -31,9 +31,8 @@ public class UserInfoItemCollector extends InfoItemCollector { public UserInfoItem extract(UserInfoItemExtractor extractor) throws ParsingException { UserInfoItem resultItem = new UserInfoItem(); // important information - resultItem.name = extractor.getUserName(); - resultItem.service_id = getServiceId(); + resultItem.name = extractor.getUserName(); resultItem.url = extractor.getWebPageUrl(); // optional information diff --git a/src/main/java/org/schabi/newpipe/extractor/utils/Utils.java b/src/main/java/org/schabi/newpipe/extractor/utils/Utils.java index 7d5480fdd..126f36e3f 100644 --- a/src/main/java/org/schabi/newpipe/extractor/utils/Utils.java +++ b/src/main/java/org/schabi/newpipe/extractor/utils/Utils.java @@ -57,7 +57,7 @@ public class Utils { } if (!Parser.isMatch(pattern, url.toLowerCase())) { - throw new ParsingException("Url not suitable for this url handler"); + throw new ParsingException("Url don't match the pattern"); } } } diff --git a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserExtractorTest.java b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserExtractorTest.java index fd3c0102e..5a791dd15 100644 --- a/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserExtractorTest.java +++ b/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserExtractorTest.java @@ -32,7 +32,6 @@ import static org.schabi.newpipe.extractor.ServiceList.YouTube; /** * Test for {@link UserExtractor} */ - public class YoutubeUserExtractorTest { UserExtractor extractor;