Skip to content

Commit 2382ef5

Browse files
authored
Merge pull request #253 from tree1891/fix_251
fix: fileName info missing #251
2 parents c734c2b + 13671d8 commit 2382ef5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/YoutubeDl.php

+12-4
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,26 @@ public function download(Options $options): VideoCollection
140140

141141
$currentVideo['extractor'] = $match['extractor'];
142142
$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) {
144146
$currentVideo['error'] = trim(substr($buffer, 11));
145147
} elseif (str_starts_with($buffer, 'ERROR:')) {
146148
$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) {
148152
$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) {
150156
$currentVideo['fileName'] = $match['file'];
151157
} elseif (preg_match('/\[(download|ffmpeg|ExtractAudio)] Destination: (?<file>.+)/', $buffer, $match) === 1 || preg_match('/\[download] (?<file>.+) has already been downloaded/', $buffer, $match) === 1) {
152158
$currentVideo['fileName'] = $match['file'];
153159
$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) {
155163
if (count($matches) > 0) {
156164
$progress = $this->progress;
157165

0 commit comments

Comments
 (0)