You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamInfoItemExtractor.java
+8-3Lines changed: 8 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,7 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
40
40
41
41
privateJsonObjectvideoInfo;
42
42
privatefinalTimeAgoParsertimeAgoParser;
43
+
privateStreamTypecachedStreamType;
43
44
44
45
/**
45
46
* Creates an extractor of StreamInfoItems from a YouTube page.
@@ -54,11 +55,15 @@ public YoutubeStreamInfoItemExtractor(JsonObject videoInfoItem, @Nullable TimeAg
54
55
55
56
@Override
56
57
publicStreamTypegetStreamType() {
58
+
if (cachedStreamType != null) {
59
+
returncachedStreamType;
60
+
}
61
+
57
62
try {
58
63
JsonArraybadges = videoInfo.getArray("badges");
59
64
for (Objectbadge : badges) {
60
65
if (((JsonObject) badge).getObject("metadataBadgeRenderer").getString("label").equals("LIVE NOW")) {
61
-
returnStreamType.LIVE_STREAM;
66
+
returncachedStreamType = StreamType.LIVE_STREAM;
62
67
}
63
68
}
64
69
@@ -68,11 +73,11 @@ public StreamType getStreamType() {
0 commit comments