Skip to content

Commit f5ecd55

Browse files
committed
fixup: add implementation to base collectors and extractor
1 parent 9bffd7e commit f5ecd55

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;
@@ -120,6 +121,14 @@ public void setTextualUploadDate(final String textualUploadDate) {
120121
this.textualUploadDate = textualUploadDate;
121122
}
122123

124+
public String getPlaylistId() {
125+
return playlistId;
126+
}
127+
128+
public void setPlaylistId(final String playlistId) {
129+
this.playlistId = playlistId;
130+
}
131+
123132
@Nullable
124133
public DateWrapper getUploadDate() {
125134
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
@@ -162,4 +162,14 @@ default boolean isShortFormContent() throws ParsingException {
162162
default ContentAvailability getContentAvailability() throws ParsingException {
163163
return ContentAvailability.UNKNOWN;
164164
}
165+
166+
/**
167+
* Gets the playlist id of the stream item.
168+
*
169+
* @return the playlist id of the stream item.
170+
* @throws ParsingException if there is an error in the extraction
171+
*/
172+
default String getPlaylistId() throws ParsingException {
173+
return "";
174+
}
165175
}

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
@@ -108,6 +108,11 @@ public StreamInfoItem extract(final StreamInfoItemExtractor extractor) throws Pa
108108
} catch (final Exception e) {
109109
addError(e);
110110
}
111+
try {
112+
resultItem.setPlaylistId(extractor.getPlaylistId());
113+
} catch (final Exception e) {
114+
addError(e);
115+
}
111116

112117
return resultItem;
113118
}

0 commit comments

Comments
 (0)