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