feat: support for meta info of videos

This commit is contained in:
Bnyro 2023-08-03 15:40:46 +02:00
parent 36edf34793
commit adacbfe285
4 changed files with 31 additions and 2 deletions

View file

@ -64,13 +64,18 @@ public class CollectionUtils {
final List<ContentItem> relatedStreams = collectRelatedItems(info.getRelatedItems());
final List<MetaInfo> metaInfo = new ObjectArrayList<>();
info.getMetaInfo().forEach(metaInfoItem -> {
metaInfo.add(new MetaInfo(metaInfoItem.getTitle(), metaInfoItem.getContent().getContent(), metaInfoItem.getUrls(), metaInfoItem.getUrlTexts()));
});
return new Streams(info.getName(), info.getDescription().getContent(),
info.getTextualUploadDate(), info.getUploaderName(), substringYouTube(info.getUploaderUrl()),
rewriteURL(info.getUploaderAvatarUrl()), rewriteURL(info.getThumbnailUrl()), info.getDuration(),
info.getViewCount(), info.getLikeCount(), info.getDislikeCount(), info.getUploaderSubscriberCount(), info.isUploaderVerified(),
audioStreams, videoStreams, relatedStreams, subtitles, livestream, rewriteVideoURL(info.getHlsUrl()),
rewriteVideoURL(info.getDashMpdUrl()), null, info.getCategory(), info.getLicence(),
info.getPrivacy().name().toLowerCase(), info.getTags(), chapters, previewFrames);
info.getPrivacy().name().toLowerCase(), info.getTags(), metaInfo, chapters, previewFrames);
}
public static List<ContentItem> collectRelatedItems(List<? extends InfoItem> items) {

View file

@ -0,0 +1,17 @@
package me.kavin.piped.utils.obj;
import java.util.List;
import java.net.URL;
public class MetaInfo {
public String title, description;
public List<URL> urls;
public List<String> urlTexts;
public MetaInfo(String title, String description, List<URL> urls, List<String> urlTexts) {
this.title = title;
this.description = description;
this.urls = urls;
this.urlTexts = urlTexts;
}
}

View file

@ -13,6 +13,8 @@ public class Streams {
public List<String> tags;
public List<MetaInfo> metaInfo;
public boolean uploaderVerified;
public long duration, views, likes, dislikes, uploaderSubscriberCount;
@ -35,7 +37,8 @@ public class Streams {
String uploaderAvatar, String thumbnailUrl, long duration, long views, long likes, long dislikes, long uploaderSubscriberCount,
boolean uploaderVerified, List<PipedStream> audioStreams, List<PipedStream> videoStreams,
List<ContentItem> relatedStreams, List<Subtitle> subtitles, boolean livestream, String hls, String dash,
String lbryId, String category, String license, String visibility, List<String> tags, List<ChapterSegment> chapters, List<PreviewFrames> previewFrames) {
String lbryId, String category, String license, String visibility, List<String> tags, List<MetaInfo> metaInfo,
List<ChapterSegment> chapters, List<PreviewFrames> previewFrames) {
this.title = title;
this.description = description;
this.uploadDate = uploadDate;
@ -62,6 +65,7 @@ public class Streams {
this.category = category;
this.license = license;
this.tags = tags;
this.metaInfo = metaInfo;
this.visibility = visibility;
}
}

View file

@ -39,6 +39,9 @@ curl "${CURLOPTS[@]}" $HOST/clips/Ugkx71jS31nwsms_Cc65oi7yXF1mILflhhrO || exit 1
# Streams
curl "${CURLOPTS[@]}" $HOST/streams/BtN-goy9VOY || exit 1
# Streams with meta info
curl "${CURLOPTS[@]}" $HOST/streams/cJ9to6EmElQ || exit 1
# Comments
curl "${CURLOPTS[@]}" $HOST/comments/BtN-goy9VOY || exit 1