@@ -104,17 +104,19 @@ public String getUploaderName() throws ParsingException {
104104 @ Nonnull
105105 @ Override
106106 public String getDashMpdUrl () throws ParsingException {
107- if (firstDashUrlFound == null ) {
108- for (int s = 0 ; s < room .getArray ("streams" ).size (); s ++) {
109- final JsonObject stream = room .getArray ("streams" ).getObject (s );
110- final JsonObject urls = stream .getObject ("urls" );
111- if (urls .has ("dash" )) {
112- firstDashUrlFound = urls .getObject ("dash" ).getString ("url" , EMPTY_STRING );
113- return firstDashUrlFound ;
114- }
107+ if (firstDashUrlFound != null ) {
108+ return firstDashUrlFound ;
109+ }
110+
111+ for (int s = 0 ; s < room .getArray ("streams" ).size (); s ++) {
112+ final JsonObject stream = room .getArray ("streams" ).getObject (s );
113+ final JsonObject urls = stream .getObject ("urls" );
114+ if (urls .has ("dash" )) {
115+ firstDashUrlFound = urls .getObject ("dash" ).getString ("url" , EMPTY_STRING );
116+ return firstDashUrlFound ;
115117 }
116- firstDashUrlFound = EMPTY_STRING ;
117118 }
119+ firstDashUrlFound = EMPTY_STRING ;
118120 return firstDashUrlFound ;
119121 }
120122
@@ -129,17 +131,19 @@ public String getDashMpdUrl() throws ParsingException {
129131 @ Nonnull
130132 @ Override
131133 public String getHlsUrl () {
132- if (firstHlsUrlFound == null ) {
133- for (int s = 0 ; s < room .getArray ("streams" ).size (); s ++) {
134- final JsonObject stream = room .getArray ("streams" ).getObject (s );
135- final JsonObject urls = stream .getObject ("urls" );
136- if (urls .has ("hls" )) {
137- firstHlsUrlFound = urls .getObject ("hls" ).getString ("url" , EMPTY_STRING );
138- return firstHlsUrlFound ;
139- }
134+ if (firstHlsUrlFound != null ) {
135+ return firstHlsUrlFound ;
136+ }
137+
138+ for (int s = 0 ; s < room .getArray ("streams" ).size (); s ++) {
139+ final JsonObject stream = room .getArray ("streams" ).getObject (s );
140+ final JsonObject urls = stream .getObject ("urls" );
141+ if (urls .has ("hls" )) {
142+ firstHlsUrlFound = urls .getObject ("hls" ).getString ("url" , EMPTY_STRING );
143+ return firstHlsUrlFound ;
140144 }
141- firstHlsUrlFound = EMPTY_STRING ;
142145 }
146+ firstHlsUrlFound = EMPTY_STRING ;
143147 return firstHlsUrlFound ;
144148 }
145149
@@ -149,7 +153,7 @@ public List<AudioStream> getAudioStreams() throws IOException, ExtractionExcepti
149153 audioStreams = new ArrayList <>();
150154 IntStream .range (0 , room .getArray ("streams" ).size ())
151155 .mapToObj (s -> room .getArray ("streams" ).getObject (s ))
152- .filter (stream -> stream .getString ("type" ).equals ("audio" ))
156+ .filter (streamJsonObject -> streamJsonObject .getString ("type" ).equals ("audio" ))
153157 .forEachOrdered (stream -> {
154158 for (final String type : stream .getObject ("urls" ).keySet ()) {
155159 final JsonObject urlObject = stream .getObject ("urls" ).getObject (type );
@@ -186,11 +190,11 @@ public List<VideoStream> getVideoStreams() throws IOException, ExtractionExcepti
186190 IntStream .range (0 , room .getArray ("streams" ).size ())
187191 .mapToObj (s -> room .getArray ("streams" ).getObject (s ))
188192 .filter (stream -> stream .getString ("type" ).equals ("video" ))
189- .forEachOrdered (stream -> {
190- final String resolution = stream .getArray ("videoSize" ).getInt (0 ) + "x"
191- + stream .getArray ("videoSize" ).getInt (1 );
192- for (final String type : stream .getObject ("urls" ).keySet ()) {
193- final JsonObject urlObject = stream .getObject ("urls" ).getObject (type );
193+ .forEachOrdered (streamJsonObject -> {
194+ final String resolution = streamJsonObject .getArray ("videoSize" ).getInt (0 )
195+ + "x" + streamJsonObject .getArray ("videoSize" ).getInt (1 );
196+ for (final String type : streamJsonObject .getObject ("urls" ).keySet ()) {
197+ final JsonObject urlObject = streamJsonObject .getObject ("urls" ).getObject (type );
194198 // The DASH manifest will be extracted with getDashMpdUrl
195199 if (!type .equals ("dash" )) {
196200 if (type .equals ("hls" )) {
0 commit comments