-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path3-download-plst.php
More file actions
32 lines (23 loc) · 826 Bytes
/
Copy path3-download-plst.php
File metadata and controls
32 lines (23 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
require_once '../vendor/autoload.php';
require_once '../src/Ytdl.php';
require_once '../src/Options.php';
use Flatgreen\Ytdl\Options;
use Flatgreen\Ytdl\Ytdl;
// download a playlist
$webpage_url = 'https://soundcloud.com/lg2-3/sets/amiral-prose-monthly-radio';
$ytdl_options = new Options();
$ytdl_options->addOptions(['-I' => '1,3']);
$ytdl = new Ytdl($ytdl_options);
$ytdl->setCache(['directory' => 'cache']);
// this can not use directly the cache informations :-(
// see 4-download-plst-with-cache.php
$info_dict = $ytdl->download($webpage_url, 'data');
$errors = $ytdl->getErrors();
if (count($errors) !== 0){
echo "<pre>" . implode(' ', $errors) . "</pre>";
} else {
header('Content-Type: application/json');
$json_string = json_encode($info_dict, JSON_PRETTY_PRINT);
echo $json_string;
}