Skip to content

Commit

Permalink
Include playlist index
Browse files Browse the repository at this point in the history
  • Loading branch information
waska14 committed Oct 5, 2021
1 parent 00d0105 commit 74f16db
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Overrides/YoutubeDl/YoutubeDl.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,21 @@ public function getQuietUrl(string $url): ?string
public function getData(string $videoUrl): ?array
{
if (!Cache::get($videoUrl)) {
$cookieParams = [];
$params = [];
if ($cookiePath = config('laravel-youtube-converter.cookies_path')) {
$cookieParams = [
$params = [
'--cookies',
$cookiePath
];
}
$process = $this->processBuilder->build($this->binPath, $this->pythonPath, array_merge($cookieParams, [
// Include playlist index
try {
parse_str(parse_url($videoUrl)['query'], $query);
if (Arr::has($query, 'index')) {
$params = array_merge($params, ['--playlist-items', $query['index']]);
}
} catch (\Throwable $e) {}
$process = $this->processBuilder->build($this->binPath, $this->pythonPath, array_merge($params, [
'-f',
'best',
'--get-url',
Expand Down

0 comments on commit 74f16db

Please sign in to comment.