Skip to content

Commit 5ebb530

Browse files
committed
Rename some variables and methods
1 parent 1a2a6df commit 5ebb530

14 files changed

Lines changed: 50 additions & 73 deletions

src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ protected UrlIdHandler getUrlIdHandler() throws ParsingException {
2121

2222
public abstract String getPlaylistId() throws ParsingException;
2323
public abstract String getPlaylistName() throws ParsingException;
24-
public abstract String getAvatarUrl() throws ParsingException;
24+
public abstract String getThumbnailUrl() throws ParsingException;
2525
public abstract String getBannerUrl() throws ParsingException;
2626
public abstract String getUploaderUrl() throws ParsingException;
2727
public abstract String getUploaderName() throws ParsingException;

src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static PlaylistInfo getInfo(PlaylistExtractor extractor) throws ParsingEx
4848
info.errors.add(e);
4949
}
5050
try {
51-
info.avatar_url = extractor.getAvatarUrl();
51+
info.thumbnail_url = extractor.getThumbnailUrl();
5252
} catch (Exception e) {
5353
info.errors.add(e);
5454
}
@@ -88,7 +88,7 @@ public static PlaylistInfo getInfo(PlaylistExtractor extractor) throws ParsingEx
8888
return info;
8989
}
9090

91-
public String avatar_url;
91+
public String thumbnail_url;
9292
public String banner_url;
9393
public String uploader_url;
9494
public String uploader_name;

src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public String getPlaylistName() {
5252
}
5353

5454
@Override
55-
public String getAvatarUrl() {
55+
public String getThumbnailUrl() {
5656
return playlist.optString("artwork_url");
5757
}
5858

src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudStreamExtractor.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public String getDescription() {
5757
}
5858

5959
@Override
60-
public String getUploader() {
60+
public String getUploaderName() {
6161
return track.getJSONObject("user").getString("username");
6262
}
6363

@@ -82,7 +82,7 @@ public String getThumbnailUrl() {
8282
}
8383

8484
@Override
85-
public String getUploaderThumbnailUrl() {
85+
public String getUploaderAvatarUrl() {
8686
return track.getJSONObject("user").getString("avatar_url");
8787
}
8888

@@ -170,11 +170,6 @@ public int getAgeLimit() {
170170
return 0;
171171
}
172172

173-
@Override
174-
public String getAverageRating() {
175-
return null;
176-
}
177-
178173
@Override
179174
public int getLikeCount() {
180175
return track.getInt("likes_count");
@@ -210,7 +205,7 @@ public StreamInfoItemCollector getRelatedVideos() throws IOException, Extraction
210205
}
211206

212207
@Override
213-
public String getUserUrl() {
208+
public String getUploaderUrl() {
214209
return track.getJSONObject("user").getString("permalink_url");
215210
}
216211

src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubePlaylistExtractor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ public String getPlaylistName() throws ParsingException {
6464
}
6565

6666
@Override
67-
public String getAvatarUrl() throws ParsingException {
67+
public String getThumbnailUrl() throws ParsingException {
6868
try {
6969
return doc.select("div[id=pl-header] div[class=pl-header-thumb] img").first().attr("abs:src");
7070
} catch (Exception e) {
71-
throw new ParsingException("Could not get playlist avatar");
71+
throw new ParsingException("Could not get playlist thumbnail");
7272
}
7373
}
7474

src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public String getDescription() throws ParsingException {
127127
}
128128

129129
@Override
130-
public String getUploader() throws ParsingException {
130+
public String getUploaderName() throws ParsingException {
131131
try {
132132
if (playerArgs == null) {
133133
return videoInfoPage.get("author");
@@ -199,7 +199,7 @@ public String getThumbnailUrl() throws ParsingException {
199199
}
200200

201201
@Override
202-
public String getUploaderThumbnailUrl() throws ParsingException {
202+
public String getUploaderAvatarUrl() throws ParsingException {
203203
try {
204204
return doc.select("a[class*=\"yt-user-photo\"]").first()
205205
.select("img").first()
@@ -459,18 +459,6 @@ public int getAgeLimit() throws ParsingException {
459459
}
460460
}
461461

462-
@Override
463-
public String getAverageRating() throws ParsingException {
464-
try {
465-
if (playerArgs == null) {
466-
return videoInfoPage.get("avg_rating");
467-
}
468-
return playerArgs.getString("avg_rating");
469-
} catch (JSONException e) {
470-
throw new ParsingException("Could not get Average rating", e);
471-
}
472-
}
473-
474462
@Override
475463
public int getLikeCount() throws ParsingException {
476464
String likesString = "";
@@ -542,7 +530,7 @@ public StreamInfoItemCollector getRelatedVideos() throws IOException, Extraction
542530
}
543531

544532
@Override
545-
public String getUserUrl() throws ParsingException {
533+
public String getUploaderUrl() throws ParsingException {
546534
try {
547535
return doc.select("div[class=\"yt-user-info\"]").first().children()
548536
.select("a").first().attr("abs:href");

src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeUserExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public String getDescription() throws ParsingException {
124124
try {
125125
return doc.select("meta[name=\"description\"]").first().attr("content");
126126
} catch(Exception e) {
127-
throw new ParsingException("Could not get channel name", e);
127+
throw new ParsingException("Could not get channel description", e);
128128
}
129129
}
130130

src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,18 @@ protected UrlIdHandler getUrlIdHandler() throws ParsingException {
4848
public abstract int getTimeStamp() throws ParsingException;
4949
public abstract String getTitle() throws ParsingException;
5050
public abstract String getDescription() throws ParsingException;
51-
public abstract String getUploader() throws ParsingException;
52-
public abstract String getUserUrl() throws ParsingException;
51+
public abstract String getUploaderName() throws ParsingException;
52+
public abstract String getUploaderUrl() throws ParsingException;
5353
public abstract int getLength() throws ParsingException;
5454
public abstract long getViewCount() throws ParsingException;
5555
public abstract String getUploadDate() throws ParsingException;
5656
public abstract String getThumbnailUrl() throws ParsingException;
57-
public abstract String getUploaderThumbnailUrl() throws ParsingException;
57+
public abstract String getUploaderAvatarUrl() throws ParsingException;
5858
public abstract List<AudioStream> getAudioStreams() throws IOException, ExtractionException;
5959
public abstract List<VideoStream> getVideoStreams() throws IOException, ExtractionException;
6060
public abstract List<VideoStream> getVideoOnlyStreams() throws IOException, ExtractionException;
6161
public abstract String getDashMpdUrl() throws ParsingException;
6262
public abstract int getAgeLimit() throws ParsingException;
63-
public abstract String getAverageRating() throws ParsingException;
6463
public abstract int getLikeCount() throws ParsingException;
6564
public abstract int getDislikeCount() throws ParsingException;
6665
public abstract StreamInfoItemExtractor getNextVideo() throws IOException, ExtractionException;

src/main/java/org/schabi/newpipe/extractor/stream/StreamInfo.java

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,12 @@ private static StreamInfo extractOptionalData(StreamInfo streamInfo, StreamExtra
190190
streamInfo.addException(e);
191191
}
192192
try {
193-
streamInfo.uploader = extractor.getUploader();
193+
streamInfo.uploader_name = extractor.getUploaderName();
194194
} catch (Exception e) {
195195
streamInfo.addException(e);
196196
}
197197
try {
198-
streamInfo.user_url = extractor.getUserUrl();
198+
streamInfo.uploader_url = extractor.getUploaderUrl();
199199
} catch (Exception e) {
200200
streamInfo.addException(e);
201201
}
@@ -215,7 +215,7 @@ private static StreamInfo extractOptionalData(StreamInfo streamInfo, StreamExtra
215215
streamInfo.addException(e);
216216
}
217217
try {
218-
streamInfo.uploader_thumbnail_url = extractor.getUploaderThumbnailUrl();
218+
streamInfo.uploader_avatar_url = extractor.getUploaderAvatarUrl();
219219
} catch (Exception e) {
220220
streamInfo.addException(e);
221221
}
@@ -224,11 +224,6 @@ private static StreamInfo extractOptionalData(StreamInfo streamInfo, StreamExtra
224224
} catch (Exception e) {
225225
streamInfo.addException(e);
226226
}
227-
try {
228-
streamInfo.average_rating = extractor.getAverageRating();
229-
} catch (Exception e) {
230-
streamInfo.addException(e);
231-
}
232227
try {
233228
streamInfo.like_count = extractor.getLikeCount();
234229
} catch (Exception e) {
@@ -269,14 +264,18 @@ public void addException(Exception e) {
269264
}
270265

271266
public StreamType stream_type;
272-
public String uploader;
273267
public String thumbnail_url;
274268
public String upload_date;
269+
public int duration = -1;
270+
public int age_limit = -1;
271+
275272
public long view_count = -1;
273+
public int like_count = -1;
274+
public int dislike_count = -1;
276275

277-
public String uploader_thumbnail_url;
278-
public String user_url;
279-
public String description;
276+
public String uploader_name;
277+
public String uploader_url;
278+
public String uploader_avatar_url;
280279

281280
public List<VideoStream> video_streams;
282281
public List<AudioStream> audio_streams;
@@ -286,14 +285,10 @@ public void addException(Exception e) {
286285
// crawling such a file is not service dependent. Therefore getting audio only streams by yust
287286
// providing the dash mpd fille will be possible in the future.
288287
public String dashMpdUrl;
289-
public int duration = -1;
290288

291-
public int age_limit = -1;
292-
public int like_count = -1;
293-
public int dislike_count = -1;
294-
public String average_rating;
295289
public StreamInfoItem next_video;
296290
public List<InfoItem> related_streams;
297291
//in seconds. some metadata is not passed using a StreamInfo object!
298292
public int start_position = 0;
293+
public String description = "";
299294
}

src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public void testGetName() throws Exception {
3939
}
4040

4141
@Test
42-
public void testGetAvatarUrl() throws Exception {
43-
assertEquals(extractor.getAvatarUrl(), "https://i1.sndcdn.com/artworks-000174203688-bweu12-large.jpg");
42+
public void testGetThumbnailUrl() throws Exception {
43+
assertEquals(extractor.getThumbnailUrl(), "https://i1.sndcdn.com/artworks-000174203688-bweu12-large.jpg");
4444
}
4545

4646
@Test

0 commit comments

Comments
 (0)