mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2025-04-29 16:30:29 +05:30
Implement support for uploaderUrl and uploaderVerified for playlists.
This commit is contained in:
parent
0f282bd3c2
commit
1c73f852b9
@ -16,7 +16,7 @@ dependencies {
|
|||||||
implementation 'it.unimi.dsi:fastutil-core:8.5.9'
|
implementation 'it.unimi.dsi:fastutil-core:8.5.9'
|
||||||
implementation 'commons-codec:commons-codec:1.15'
|
implementation 'commons-codec:commons-codec:1.15'
|
||||||
implementation 'org.bouncycastle:bcprov-jdk15on:1.70'
|
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.github.FireMasterK:nanojson:5df3e81e87b791d01f132f376e4b7d4a1780f346'
|
||||||
implementation 'com.fasterxml.jackson.core:jackson-core:2.13.4'
|
implementation 'com.fasterxml.jackson.core:jackson-core:2.13.4'
|
||||||
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.4'
|
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.4'
|
||||||
|
@ -21,14 +21,16 @@ public class CollectionUtils {
|
|||||||
.stream()
|
.stream()
|
||||||
.parallel()
|
.parallel()
|
||||||
.map(item -> {
|
.map(item -> {
|
||||||
if (item instanceof StreamInfoItem)
|
if (item instanceof StreamInfoItem) {
|
||||||
return collectRelatedStream(item);
|
return collectRelatedStream(item);
|
||||||
else if (item instanceof PlaylistInfoItem)
|
} else if (item instanceof PlaylistInfoItem) {
|
||||||
return collectRelatedPlaylist(item);
|
return collectRelatedPlaylist(item);
|
||||||
else if (item instanceof ChannelInfoItem)
|
} else if (item instanceof ChannelInfoItem) {
|
||||||
return collectRelatedChannel(item);
|
return collectRelatedChannel(item);
|
||||||
else
|
} else {
|
||||||
throw new RuntimeException("Unknown item type: " + item.getClass().getName());
|
throw new RuntimeException(
|
||||||
|
"Unknown item type: " + item.getClass().getName());
|
||||||
|
}
|
||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,25 +38,34 @@ public class CollectionUtils {
|
|||||||
|
|
||||||
StreamInfoItem item = (StreamInfoItem) o;
|
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()),
|
item.getUploaderName(), substringYouTube(item.getUploaderUrl()),
|
||||||
rewriteURL(item.getUploaderAvatarUrl()), item.getTextualUploadDate(), item.getShortDescription(), item.getDuration(),
|
rewriteURL(item.getUploaderAvatarUrl()), item.getTextualUploadDate(),
|
||||||
item.getViewCount(), item.getUploadDate() != null ? item.getUploadDate().offsetDateTime().toInstant().toEpochMilli() : -1, item.isUploaderVerified(), item.isShortFormContent());
|
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) {
|
private static PlaylistItem collectRelatedPlaylist(Object o) {
|
||||||
|
|
||||||
PlaylistInfoItem item = (PlaylistInfoItem) o;
|
PlaylistInfoItem item = (PlaylistInfoItem) o;
|
||||||
|
|
||||||
return new PlaylistItem(substringYouTube(item.getUrl()), item.getName(), rewriteURL(item.getThumbnailUrl()),
|
return new PlaylistItem(substringYouTube(item.getUrl()), item.getName(),
|
||||||
item.getUploaderName(), item.getPlaylistType().name(), item.getStreamCount());
|
rewriteURL(item.getThumbnailUrl()),
|
||||||
|
item.getUploaderName(), substringYouTube(item.getUploaderUrl()),
|
||||||
|
item.isUploaderVerified(),
|
||||||
|
item.getPlaylistType().name(), item.getStreamCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ChannelItem collectRelatedChannel(Object o) {
|
private static ChannelItem collectRelatedChannel(Object o) {
|
||||||
|
|
||||||
ChannelInfoItem item = (ChannelInfoItem) o;
|
ChannelInfoItem item = (ChannelInfoItem) o;
|
||||||
|
|
||||||
return new ChannelItem(substringYouTube(item.getUrl()), item.getName(), rewriteURL(item.getThumbnailUrl()),
|
return new ChannelItem(substringYouTube(item.getUrl()), item.getName(),
|
||||||
item.getDescription(), item.getSubscriberCount(), item.getStreamCount(), item.isVerified());
|
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 name;
|
||||||
public String thumbnail;
|
public String thumbnail;
|
||||||
public String uploaderName;
|
public String uploaderName;
|
||||||
|
public String uploaderUrl;
|
||||||
|
public boolean uploaderVerified;
|
||||||
public String playlistType;
|
public String playlistType;
|
||||||
|
|
||||||
public long videos;
|
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);
|
super(url);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.thumbnail = thumbnail;
|
this.thumbnail = thumbnail;
|
||||||
this.uploaderName = uploaderName;
|
this.uploaderName = uploaderName;
|
||||||
|
this.uploaderUrl = uploaderUrl;
|
||||||
|
this.uploaderVerified = uploaderVerified;
|
||||||
this.playlistType = playlistType;
|
this.playlistType = playlistType;
|
||||||
this.videos = videos;
|
this.videos = videos;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user