@@ -140,18 +140,26 @@ public function download(Options $options): VideoCollection
140
140
141
141
$ currentVideo ['extractor ' ] = $ match ['extractor ' ];
142
142
$ currentVideo ['id ' ] = $ match ['id ' ];
143
- } elseif (preg_match ('/\[download] File is (larger|smaller) than (min|max)-filesize/ ' , $ buffer , $ match ) === 1 ) {
143
+ }
144
+
145
+ if (preg_match ('/\[download] File is (larger|smaller) than (min|max)-filesize/ ' , $ buffer , $ match ) === 1 ) {
144
146
$ currentVideo ['error ' ] = trim (substr ($ buffer , 11 ));
145
147
} elseif (str_starts_with ($ buffer , 'ERROR: ' )) {
146
148
$ currentVideo ['error ' ] = trim (substr ($ buffer , 6 ));
147
- } elseif (preg_match ('/Writing video( description)? metadata as JSON to:\s(?<metadataFile>.+)/ ' , $ buffer , $ match ) === 1 ) {
149
+ }
150
+
151
+ if (preg_match ('/Writing video( description)? metadata as JSON to:\s(?<metadataFile>.+)/ ' , $ buffer , $ match ) === 1 ) {
148
152
$ currentVideo ['metadataFile ' ] = $ match ['metadataFile ' ];
149
- } elseif (preg_match ('/\[(ffmpeg|Merger)] Merging formats into "(?<file>.+)"/ ' , $ buffer , $ match ) === 1 ) {
153
+ }
154
+
155
+ if (preg_match ('/\[(ffmpeg|Merger)] Merging formats into "(?<file>.+)"/ ' , $ buffer , $ match ) === 1 ) {
150
156
$ currentVideo ['fileName ' ] = $ match ['file ' ];
151
157
} elseif (preg_match ('/\[(download|ffmpeg|ExtractAudio)] Destination: (?<file>.+)/ ' , $ buffer , $ match ) === 1 || preg_match ('/\[download] (?<file>.+) has already been downloaded/ ' , $ buffer , $ match ) === 1 ) {
152
158
$ currentVideo ['fileName ' ] = $ match ['file ' ];
153
159
$ progressTarget = basename ($ match ['file ' ]);
154
- } elseif (preg_match_all (static ::PROGRESS_PATTERN , $ buffer , $ matches , PREG_SET_ORDER ) !== false ) {
160
+ }
161
+
162
+ if (preg_match_all (static ::PROGRESS_PATTERN , $ buffer , $ matches , PREG_SET_ORDER ) !== false ) {
155
163
if (count ($ matches ) > 0 ) {
156
164
$ progress = $ this ->progress ;
157
165
0 commit comments