Change future code and add uploaderSubscriberCount. (#234)

This commit is contained in:
Kavin 2022-03-30 17:23:56 +01:00 committed by GitHub
parent 236a285c0c
commit 0cea0a50f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 12 deletions

View File

@ -16,7 +16,7 @@ dependencies {
implementation 'it.unimi.dsi:fastutil-core:8.5.8'
implementation 'commons-codec:commons-codec:1.15'
implementation 'org.bouncycastle:bcprov-jdk15on:1.70'
implementation 'com.github.FireMasterK.NewPipeExtractor:NewPipeExtractor:87df3331f419e1a93690d3f34eb50c7c14ff4aa1'
implementation 'com.github.FireMasterK.NewPipeExtractor:NewPipeExtractor:cc569414b43fd9c8c8e11673a4b20f6c6146016e'
implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
implementation 'com.fasterxml.jackson.core:jackson-core:2.13.2'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.2'

View File

@ -85,7 +85,7 @@ public class ResponseHelper {
final var futureLBRY = Multithreading.supplyAsync(() -> {
try {
String lbryId = futureLbryId.completeOnTimeout(null, 2, TimeUnit.SECONDS).get();
String lbryId = futureLbryId.get(2, TimeUnit.SECONDS);
return LbryHelper.getLBRYStreamURL(lbryId);
} catch (Exception e) {
@ -113,7 +113,7 @@ public class ResponseHelper {
String lbryURL = null;
try {
lbryURL = futureLBRY.completeOnTimeout(null, 3, TimeUnit.SECONDS).get();
lbryURL = futureLBRY.get(3, TimeUnit.SECONDS);
} catch (Exception e) {
// ignored
}
@ -153,9 +153,9 @@ public class ResponseHelper {
final Streams streams = 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.isUploaderVerified(),
info.getViewCount(), info.getLikeCount(), info.getDislikeCount(), info.getUploaderSubscriberCount(), info.isUploaderVerified(),
audioStreams, videoStreams, relatedStreams, subtitles, livestream, rewriteURL(info.getHlsUrl()),
rewriteURL(info.getDashMpdUrl()), futureLbryId.get(), chapters);
rewriteURL(info.getDashMpdUrl()), futureLbryId.get(2, TimeUnit.SECONDS), chapters);
return Constants.mapper.writeValueAsBytes(streams);

View File

@ -1,9 +1,9 @@
package me.kavin.piped.utils.obj;
import java.util.List;
import me.kavin.piped.consts.Constants;
import java.util.List;
public class Streams {
public String title, description, uploadDate, uploader, uploaderUrl, uploaderAvatar, thumbnailUrl, hls, dash,
@ -11,7 +11,7 @@ public class Streams {
public boolean uploaderVerified;
public long duration, views, likes, dislikes;
public long duration, views, likes, dislikes, uploaderSubscriberCount;
public List<PipedStream> audioStreams, videoStreams;
@ -26,10 +26,10 @@ public class Streams {
public List<ChapterSegment> chapters;
public Streams(String title, String description, String uploadDate, String uploader, String uploaderUrl,
String uploaderAvatar, String thumbnailUrl, long duration, long views, long likes, long dislikes,
boolean uploaderVerified, List<PipedStream> audioStreams, List<PipedStream> videoStreams,
List<StreamItem> relatedStreams, List<Subtitle> subtitles, boolean livestream, String hls, String dash,
String lbryId, List<ChapterSegment> chapters) {
String uploaderAvatar, String thumbnailUrl, long duration, long views, long likes, long dislikes, long uploaderSubscriberCount,
boolean uploaderVerified, List<PipedStream> audioStreams, List<PipedStream> videoStreams,
List<StreamItem> relatedStreams, List<Subtitle> subtitles, boolean livestream, String hls, String dash,
String lbryId, List<ChapterSegment> chapters) {
this.title = title;
this.description = description;
this.uploadDate = uploadDate;
@ -41,6 +41,7 @@ public class Streams {
this.views = views;
this.likes = likes;
this.dislikes = dislikes;
this.uploaderSubscriberCount = uploaderSubscriberCount;
this.uploaderVerified = uploaderVerified;
this.audioStreams = audioStreams;
this.videoStreams = videoStreams;