mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-12 21:30:33 +05:30
Rename some variables and methods
This commit is contained in:
parent
1a2a6df7ec
commit
5ebb5301c9
@ -21,7 +21,7 @@ public abstract class PlaylistExtractor extends ListExtractor {
|
||||
|
||||
public abstract String getPlaylistId() throws ParsingException;
|
||||
public abstract String getPlaylistName() throws ParsingException;
|
||||
public abstract String getAvatarUrl() throws ParsingException;
|
||||
public abstract String getThumbnailUrl() throws ParsingException;
|
||||
public abstract String getBannerUrl() throws ParsingException;
|
||||
public abstract String getUploaderUrl() throws ParsingException;
|
||||
public abstract String getUploaderName() throws ParsingException;
|
||||
|
@ -48,7 +48,7 @@ public class PlaylistInfo extends ListInfo {
|
||||
info.errors.add(e);
|
||||
}
|
||||
try {
|
||||
info.avatar_url = extractor.getAvatarUrl();
|
||||
info.thumbnail_url = extractor.getThumbnailUrl();
|
||||
} catch (Exception e) {
|
||||
info.errors.add(e);
|
||||
}
|
||||
@ -88,7 +88,7 @@ public class PlaylistInfo extends ListInfo {
|
||||
return info;
|
||||
}
|
||||
|
||||
public String avatar_url;
|
||||
public String thumbnail_url;
|
||||
public String banner_url;
|
||||
public String uploader_url;
|
||||
public String uploader_name;
|
||||
|
@ -52,7 +52,7 @@ public class SoundcloudPlaylistExtractor extends PlaylistExtractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAvatarUrl() {
|
||||
public String getThumbnailUrl() {
|
||||
return playlist.optString("artwork_url");
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUploader() {
|
||||
public String getUploaderName() {
|
||||
return track.getJSONObject("user").getString("username");
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUploaderThumbnailUrl() {
|
||||
public String getUploaderAvatarUrl() {
|
||||
return track.getJSONObject("user").getString("avatar_url");
|
||||
}
|
||||
|
||||
@ -170,11 +170,6 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAverageRating() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLikeCount() {
|
||||
return track.getInt("likes_count");
|
||||
@ -210,7 +205,7 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserUrl() {
|
||||
public String getUploaderUrl() {
|
||||
return track.getJSONObject("user").getString("permalink_url");
|
||||
}
|
||||
|
||||
|
@ -64,11 +64,11 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAvatarUrl() throws ParsingException {
|
||||
public String getThumbnailUrl() throws ParsingException {
|
||||
try {
|
||||
return doc.select("div[id=pl-header] div[class=pl-header-thumb] img").first().attr("abs:src");
|
||||
} catch (Exception e) {
|
||||
throw new ParsingException("Could not get playlist avatar");
|
||||
throw new ParsingException("Could not get playlist thumbnail");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUploader() throws ParsingException {
|
||||
public String getUploaderName() throws ParsingException {
|
||||
try {
|
||||
if (playerArgs == null) {
|
||||
return videoInfoPage.get("author");
|
||||
@ -199,7 +199,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUploaderThumbnailUrl() throws ParsingException {
|
||||
public String getUploaderAvatarUrl() throws ParsingException {
|
||||
try {
|
||||
return doc.select("a[class*=\"yt-user-photo\"]").first()
|
||||
.select("img").first()
|
||||
@ -459,18 +459,6 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAverageRating() throws ParsingException {
|
||||
try {
|
||||
if (playerArgs == null) {
|
||||
return videoInfoPage.get("avg_rating");
|
||||
}
|
||||
return playerArgs.getString("avg_rating");
|
||||
} catch (JSONException e) {
|
||||
throw new ParsingException("Could not get Average rating", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLikeCount() throws ParsingException {
|
||||
String likesString = "";
|
||||
@ -542,7 +530,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserUrl() throws ParsingException {
|
||||
public String getUploaderUrl() throws ParsingException {
|
||||
try {
|
||||
return doc.select("div[class=\"yt-user-info\"]").first().children()
|
||||
.select("a").first().attr("abs:href");
|
||||
|
@ -124,7 +124,7 @@ public class YoutubeUserExtractor extends UserExtractor {
|
||||
try {
|
||||
return doc.select("meta[name=\"description\"]").first().attr("content");
|
||||
} catch(Exception e) {
|
||||
throw new ParsingException("Could not get channel name", e);
|
||||
throw new ParsingException("Could not get channel description", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,19 +48,18 @@ public abstract class StreamExtractor extends Extractor {
|
||||
public abstract int getTimeStamp() throws ParsingException;
|
||||
public abstract String getTitle() throws ParsingException;
|
||||
public abstract String getDescription() throws ParsingException;
|
||||
public abstract String getUploader() throws ParsingException;
|
||||
public abstract String getUserUrl() throws ParsingException;
|
||||
public abstract String getUploaderName() throws ParsingException;
|
||||
public abstract String getUploaderUrl() throws ParsingException;
|
||||
public abstract int getLength() throws ParsingException;
|
||||
public abstract long getViewCount() throws ParsingException;
|
||||
public abstract String getUploadDate() throws ParsingException;
|
||||
public abstract String getThumbnailUrl() throws ParsingException;
|
||||
public abstract String getUploaderThumbnailUrl() throws ParsingException;
|
||||
public abstract String getUploaderAvatarUrl() throws ParsingException;
|
||||
public abstract List<AudioStream> getAudioStreams() throws IOException, ExtractionException;
|
||||
public abstract List<VideoStream> getVideoStreams() throws IOException, ExtractionException;
|
||||
public abstract List<VideoStream> getVideoOnlyStreams() throws IOException, ExtractionException;
|
||||
public abstract String getDashMpdUrl() throws ParsingException;
|
||||
public abstract int getAgeLimit() throws ParsingException;
|
||||
public abstract String getAverageRating() throws ParsingException;
|
||||
public abstract int getLikeCount() throws ParsingException;
|
||||
public abstract int getDislikeCount() throws ParsingException;
|
||||
public abstract StreamInfoItemExtractor getNextVideo() throws IOException, ExtractionException;
|
||||
|
@ -190,12 +190,12 @@ public class StreamInfo extends Info {
|
||||
streamInfo.addException(e);
|
||||
}
|
||||
try {
|
||||
streamInfo.uploader = extractor.getUploader();
|
||||
streamInfo.uploader_name = extractor.getUploaderName();
|
||||
} catch (Exception e) {
|
||||
streamInfo.addException(e);
|
||||
}
|
||||
try {
|
||||
streamInfo.user_url = extractor.getUserUrl();
|
||||
streamInfo.uploader_url = extractor.getUploaderUrl();
|
||||
} catch (Exception e) {
|
||||
streamInfo.addException(e);
|
||||
}
|
||||
@ -215,7 +215,7 @@ public class StreamInfo extends Info {
|
||||
streamInfo.addException(e);
|
||||
}
|
||||
try {
|
||||
streamInfo.uploader_thumbnail_url = extractor.getUploaderThumbnailUrl();
|
||||
streamInfo.uploader_avatar_url = extractor.getUploaderAvatarUrl();
|
||||
} catch (Exception e) {
|
||||
streamInfo.addException(e);
|
||||
}
|
||||
@ -224,11 +224,6 @@ public class StreamInfo extends Info {
|
||||
} catch (Exception e) {
|
||||
streamInfo.addException(e);
|
||||
}
|
||||
try {
|
||||
streamInfo.average_rating = extractor.getAverageRating();
|
||||
} catch (Exception e) {
|
||||
streamInfo.addException(e);
|
||||
}
|
||||
try {
|
||||
streamInfo.like_count = extractor.getLikeCount();
|
||||
} catch (Exception e) {
|
||||
@ -269,14 +264,18 @@ public class StreamInfo extends Info {
|
||||
}
|
||||
|
||||
public StreamType stream_type;
|
||||
public String uploader;
|
||||
public String thumbnail_url;
|
||||
public String upload_date;
|
||||
public long view_count = -1;
|
||||
public int duration = -1;
|
||||
public int age_limit = -1;
|
||||
|
||||
public String uploader_thumbnail_url;
|
||||
public String user_url;
|
||||
public String description;
|
||||
public long view_count = -1;
|
||||
public int like_count = -1;
|
||||
public int dislike_count = -1;
|
||||
|
||||
public String uploader_name;
|
||||
public String uploader_url;
|
||||
public String uploader_avatar_url;
|
||||
|
||||
public List<VideoStream> video_streams;
|
||||
public List<AudioStream> audio_streams;
|
||||
@ -286,14 +285,10 @@ public class StreamInfo extends Info {
|
||||
// crawling such a file is not service dependent. Therefore getting audio only streams by yust
|
||||
// providing the dash mpd fille will be possible in the future.
|
||||
public String dashMpdUrl;
|
||||
public int duration = -1;
|
||||
|
||||
public int age_limit = -1;
|
||||
public int like_count = -1;
|
||||
public int dislike_count = -1;
|
||||
public String average_rating;
|
||||
public StreamInfoItem next_video;
|
||||
public List<InfoItem> related_streams;
|
||||
//in seconds. some metadata is not passed using a StreamInfo object!
|
||||
public int start_position = 0;
|
||||
public String description = "";
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ public class SoundcloudPlaylistExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAvatarUrl() throws Exception {
|
||||
assertEquals(extractor.getAvatarUrl(), "https://i1.sndcdn.com/artworks-000174203688-bweu12-large.jpg");
|
||||
public void testGetThumbnailUrl() throws Exception {
|
||||
assertEquals(extractor.getThumbnailUrl(), "https://i1.sndcdn.com/artworks-000174203688-bweu12-large.jpg");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -50,8 +50,8 @@ public class SoundcloudStreamExtractorDefaultTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUploader() throws ParsingException {
|
||||
assertEquals(extractor.getUploader(), "LIL UZI VERT");
|
||||
public void testGetUploaderName() throws ParsingException {
|
||||
assertEquals(extractor.getUploaderName(), "LIL UZI VERT");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -71,8 +71,8 @@ public class SoundcloudStreamExtractorDefaultTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUserUrl() throws ParsingException {
|
||||
assertEquals(extractor.getUserUrl(), "http://soundcloud.com/liluzivert");
|
||||
public void testGetUploaderUrl() throws ParsingException {
|
||||
assertEquals(extractor.getUploaderUrl(), "http://soundcloud.com/liluzivert");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -81,8 +81,8 @@ public class SoundcloudStreamExtractorDefaultTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUploaderThumbnailUrl() throws ParsingException {
|
||||
assertEquals(extractor.getUploaderThumbnailUrl(), "https://a1.sndcdn.com/images/default_avatar_large.png");
|
||||
public void testGetUploaderAvatarUrl() throws ParsingException {
|
||||
assertEquals(extractor.getUploaderAvatarUrl(), "https://a1.sndcdn.com/images/default_avatar_large.png");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -39,8 +39,8 @@ public class YoutubePlaylistExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAvatarUrl() throws Exception {
|
||||
assertTrue(extractor.getAvatarUrl(), extractor.getAvatarUrl().contains("yt"));
|
||||
public void testGetThumbnailUrl() throws Exception {
|
||||
assertTrue(extractor.getThumbnailUrl(), extractor.getThumbnailUrl().contains("yt"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -74,8 +74,8 @@ public class YoutubeStreamExtractorDefaultTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUploader() throws ParsingException {
|
||||
assertTrue(!extractor.getUploader().isEmpty());
|
||||
public void testGetUploaderName() throws ParsingException {
|
||||
assertTrue(!extractor.getUploaderName().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -95,8 +95,8 @@ public class YoutubeStreamExtractorDefaultTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUserlUrl() throws ParsingException {
|
||||
assertTrue(extractor.getUserUrl().length() > 0);
|
||||
public void testGetUploaderUrl() throws ParsingException {
|
||||
assertTrue(extractor.getUploaderUrl().length() > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -106,9 +106,9 @@ public class YoutubeStreamExtractorDefaultTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUploaderThumbnailUrl() throws ParsingException {
|
||||
assertTrue(extractor.getUploaderThumbnailUrl(),
|
||||
extractor.getUploaderThumbnailUrl().contains(HTTPS));
|
||||
public void testGetUploaderAvatarUrl() throws ParsingException {
|
||||
assertTrue(extractor.getUploaderAvatarUrl(),
|
||||
extractor.getUploaderAvatarUrl().contains(HTTPS));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -58,8 +58,8 @@ public class YoutubeStreamExtractorRestrictedTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUploader() throws ParsingException {
|
||||
assertTrue(!extractor.getUploader().isEmpty());
|
||||
public void testGetUploaderName() throws ParsingException {
|
||||
assertTrue(!extractor.getUploaderName().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -84,9 +84,9 @@ public class YoutubeStreamExtractorRestrictedTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetUploaderThumbnailUrl() throws ParsingException {
|
||||
assertTrue(extractor.getUploaderThumbnailUrl(),
|
||||
extractor.getUploaderThumbnailUrl().contains(HTTPS));
|
||||
public void testGetUploaderAvatarUrl() throws ParsingException {
|
||||
assertTrue(extractor.getUploaderAvatarUrl(),
|
||||
extractor.getUploaderAvatarUrl().contains(HTTPS));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user