kopia lustrzana https://github.com/TeamNewPipe/NewPipeExtractor
Merge b0d7dea83d
into b469dcacf0
commit
37c952dda2
|
@ -174,4 +174,26 @@ public class YoutubeMusicSongOrVideoInfoItemExtractor implements StreamInfoItemE
|
||||||
throw new ParsingException("Could not get thumbnails", e);
|
throw new ParsingException("Could not get thumbnails", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPlaylistId() throws ParsingException {
|
||||||
|
if (searchType.equals(MUSIC_SONGS)) {
|
||||||
|
for (final Object item : descriptionElements) {
|
||||||
|
final JsonObject browseEndpoint = ((JsonObject) item)
|
||||||
|
.getObject("navigationEndpoint")
|
||||||
|
.getObject("browseEndpoint");
|
||||||
|
|
||||||
|
final String type = browseEndpoint
|
||||||
|
.getObject("browseEndpointContextSupportedConfigs")
|
||||||
|
.getObject("browseEndpointContextMusicConfig")
|
||||||
|
.getString("pageType");
|
||||||
|
|
||||||
|
if (type != null && type.equals("MUSIC_PAGE_TYPE_ALBUM")) {
|
||||||
|
return browseEndpoint.getString("browseId");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// handles singles, video, and others which may not belong in playlist
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class StreamInfoItem extends InfoItem {
|
||||||
private String uploaderName;
|
private String uploaderName;
|
||||||
private String shortDescription;
|
private String shortDescription;
|
||||||
private String textualUploadDate;
|
private String textualUploadDate;
|
||||||
|
private String playlistId;
|
||||||
@Nullable
|
@Nullable
|
||||||
private DateWrapper uploadDate;
|
private DateWrapper uploadDate;
|
||||||
private long viewCount = -1;
|
private long viewCount = -1;
|
||||||
|
@ -118,6 +119,14 @@ public class StreamInfoItem extends InfoItem {
|
||||||
this.textualUploadDate = textualUploadDate;
|
this.textualUploadDate = textualUploadDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPlaylistId() {
|
||||||
|
return playlistId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlaylistId(final String playlistId) {
|
||||||
|
this.playlistId = playlistId;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public DateWrapper getUploadDate() {
|
public DateWrapper getUploadDate() {
|
||||||
return uploadDate;
|
return uploadDate;
|
||||||
|
|
|
@ -147,4 +147,14 @@ public interface StreamInfoItemExtractor extends InfoItemExtractor {
|
||||||
default boolean isShortFormContent() throws ParsingException {
|
default boolean isShortFormContent() throws ParsingException {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the playlist id of the stream item.
|
||||||
|
*
|
||||||
|
* @return the playlist id of the stream item.
|
||||||
|
* @throws ParsingException if there is an error in the extraction
|
||||||
|
*/
|
||||||
|
default String getPlaylistId() throws ParsingException {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,11 @@ public class StreamInfoItemsCollector
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
addError(e);
|
addError(e);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
resultItem.setPlaylistId(extractor.getPlaylistId());
|
||||||
|
} catch (final Exception e) {
|
||||||
|
addError(e);
|
||||||
|
}
|
||||||
|
|
||||||
return resultItem;
|
return resultItem;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue