Skip to content

Commit e938ae0

Browse files
committed
fixup: add implementation to base collectors and extractors
1 parent 3d82eae commit e938ae0

4 files changed

Lines changed: 26 additions & 2 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMusicSongOrVideoInfoItemExtractor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ public List<Image> getThumbnails() throws ParsingException {
175175
}
176176
}
177177

178-
@Nonnull
179-
public String getPlaylist() {
178+
@Override
179+
public String getPlaylistId() throws ParsingException {
180180
if (searchType.equals(MUSIC_SONGS)) {
181181
for (final Object item : descriptionElements) {
182182
final JsonObject browseEndpoint = ((JsonObject) item)

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class StreamInfoItem extends InfoItem {
3737
private String uploaderName;
3838
private String shortDescription;
3939
private String textualUploadDate;
40+
private String playlistId;
4041
@Nullable
4142
private DateWrapper uploadDate;
4243
private long viewCount = -1;
@@ -118,6 +119,14 @@ public void setTextualUploadDate(final String textualUploadDate) {
118119
this.textualUploadDate = textualUploadDate;
119120
}
120121

122+
public String getPlaylistId() {
123+
return playlistId;
124+
}
125+
126+
public void setPlaylistId(final String playlistId) {
127+
this.playlistId = playlistId;
128+
}
129+
121130
@Nullable
122131
public DateWrapper getUploadDate() {
123132
return uploadDate;

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,14 @@ default String getShortDescription() throws ParsingException {
147147
default boolean isShortFormContent() throws ParsingException {
148148
return false;
149149
}
150+
151+
/**
152+
* Gets the playlist id of the stream item.
153+
*
154+
* @return the playlist id of the stream item.
155+
* @throws ParsingException if there is an error in the extraction
156+
*/
157+
default String getPlaylistId() throws ParsingException {
158+
return "";
159+
}
150160
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ public StreamInfoItem extract(final StreamInfoItemExtractor extractor) throws Pa
103103
} catch (final Exception e) {
104104
addError(e);
105105
}
106+
try {
107+
resultItem.setPlaylistId(extractor.getPlaylistId());
108+
} catch (final Exception e) {
109+
addError(e);
110+
}
106111

107112
return resultItem;
108113
}

0 commit comments

Comments
 (0)