mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Merge pull request #408 from TeamPiped/playlist-info
Implement support for uploaderUrl and uploaderVerified for playlists.
This commit is contained in:
commit
6c067ef3fe
3 changed files with 31 additions and 14 deletions
|
@ -16,7 +16,7 @@ dependencies {
|
|||
implementation 'it.unimi.dsi:fastutil-core:8.5.9'
|
||||
implementation 'commons-codec:commons-codec:1.15'
|
||||
implementation 'org.bouncycastle:bcprov-jdk15on:1.70'
|
||||
implementation 'com.github.FireMasterK.NewPipeExtractor:NewPipeExtractor:da15ba74793254079123fee984154b2697d4a992'
|
||||
implementation 'com.github.FireMasterK.NewPipeExtractor:NewPipeExtractor:389ec4bd58b8b18ea0296cb63e156c524cfc3fe0'
|
||||
implementation 'com.github.FireMasterK:nanojson:5df3e81e87b791d01f132f376e4b7d4a1780f346'
|
||||
implementation 'com.fasterxml.jackson.core:jackson-core:2.13.4'
|
||||
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.4'
|
||||
|
|
|
@ -21,14 +21,16 @@ public class CollectionUtils {
|
|||
.stream()
|
||||
.parallel()
|
||||
.map(item -> {
|
||||
if (item instanceof StreamInfoItem)
|
||||
if (item instanceof StreamInfoItem) {
|
||||
return collectRelatedStream(item);
|
||||
else if (item instanceof PlaylistInfoItem)
|
||||
} else if (item instanceof PlaylistInfoItem) {
|
||||
return collectRelatedPlaylist(item);
|
||||
else if (item instanceof ChannelInfoItem)
|
||||
} else if (item instanceof ChannelInfoItem) {
|
||||
return collectRelatedChannel(item);
|
||||
else
|
||||
throw new RuntimeException("Unknown item type: " + item.getClass().getName());
|
||||
} else {
|
||||
throw new RuntimeException(
|
||||
"Unknown item type: " + item.getClass().getName());
|
||||
}
|
||||
}).toList();
|
||||
}
|
||||
|
||||
|
@ -36,25 +38,34 @@ public class CollectionUtils {
|
|||
|
||||
StreamInfoItem item = (StreamInfoItem) o;
|
||||
|
||||
return new StreamItem(substringYouTube(item.getUrl()), item.getName(), rewriteURL(item.getThumbnailUrl()),
|
||||
return new StreamItem(substringYouTube(item.getUrl()), item.getName(),
|
||||
rewriteURL(item.getThumbnailUrl()),
|
||||
item.getUploaderName(), substringYouTube(item.getUploaderUrl()),
|
||||
rewriteURL(item.getUploaderAvatarUrl()), item.getTextualUploadDate(), item.getShortDescription(), item.getDuration(),
|
||||
item.getViewCount(), item.getUploadDate() != null ? item.getUploadDate().offsetDateTime().toInstant().toEpochMilli() : -1, item.isUploaderVerified(), item.isShortFormContent());
|
||||
rewriteURL(item.getUploaderAvatarUrl()), item.getTextualUploadDate(),
|
||||
item.getShortDescription(), item.getDuration(),
|
||||
item.getViewCount(), item.getUploadDate() != null ?
|
||||
item.getUploadDate().offsetDateTime().toInstant().toEpochMilli() : -1,
|
||||
item.isUploaderVerified(), item.isShortFormContent());
|
||||
}
|
||||
|
||||
private static PlaylistItem collectRelatedPlaylist(Object o) {
|
||||
|
||||
PlaylistInfoItem item = (PlaylistInfoItem) o;
|
||||
|
||||
return new PlaylistItem(substringYouTube(item.getUrl()), item.getName(), rewriteURL(item.getThumbnailUrl()),
|
||||
item.getUploaderName(), item.getPlaylistType().name(), item.getStreamCount());
|
||||
return new PlaylistItem(substringYouTube(item.getUrl()), item.getName(),
|
||||
rewriteURL(item.getThumbnailUrl()),
|
||||
item.getUploaderName(), substringYouTube(item.getUploaderUrl()),
|
||||
item.isUploaderVerified(),
|
||||
item.getPlaylistType().name(), item.getStreamCount());
|
||||
}
|
||||
|
||||
private static ChannelItem collectRelatedChannel(Object o) {
|
||||
|
||||
ChannelInfoItem item = (ChannelInfoItem) o;
|
||||
|
||||
return new ChannelItem(substringYouTube(item.getUrl()), item.getName(), rewriteURL(item.getThumbnailUrl()),
|
||||
item.getDescription(), item.getSubscriberCount(), item.getStreamCount(), item.isVerified());
|
||||
return new ChannelItem(substringYouTube(item.getUrl()), item.getName(),
|
||||
rewriteURL(item.getThumbnailUrl()),
|
||||
item.getDescription(), item.getSubscriberCount(), item.getStreamCount(),
|
||||
item.isVerified());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,16 +7,22 @@ public class PlaylistItem extends ContentItem {
|
|||
public String name;
|
||||
public String thumbnail;
|
||||
public String uploaderName;
|
||||
public String uploaderUrl;
|
||||
public boolean uploaderVerified;
|
||||
public String playlistType;
|
||||
|
||||
public long videos;
|
||||
|
||||
|
||||
public PlaylistItem(String url, String name, String thumbnail, String uploaderName, String playlistType, long videos) {
|
||||
public PlaylistItem(String url, String name, String thumbnail, String uploaderName,
|
||||
String uploaderUrl, boolean uploaderVerified, String playlistType,
|
||||
long videos) {
|
||||
super(url);
|
||||
this.name = name;
|
||||
this.thumbnail = thumbnail;
|
||||
this.uploaderName = uploaderName;
|
||||
this.uploaderUrl = uploaderUrl;
|
||||
this.uploaderVerified = uploaderVerified;
|
||||
this.playlistType = playlistType;
|
||||
this.videos = videos;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue