├── README.md ├── helper.php ├── index.php ├── screenshot ├── 1.png └── 2.png └── storyboard.php /README.md: -------------------------------------------------------------------------------- 1 | # youtube-downloader 2 | 3 | run with PHP 4 | 5 | ` 6 | copy code to your directory 7 | ` 8 | 9 | open url 10 | ` 11 | http://YOUR_URL/PATH/TO/FILE/index.php?v=YOUTUBE_ID 12 | ` 13 | 14 | ## How to merge Video and Audio with VLC 15 | 1. file > advanced open file 16 | 2. select tab file 17 | 3. browse video file 18 | 4. checked Play another media synchronously and browse audio file 19 | 5. checked Streamimg/Saving and click setting... 20 | 6. browse file for save output 21 | 7. select mpeg 4 22 | 8. click OK 23 | 9. click open and wait 24 | 25 | ![](https://raw.githubusercontent.com/dagdun/youtube-downloader/master/screenshot/1.png) 26 | ![](https://raw.githubusercontent.com/dagdun/youtube-downloader/master/screenshot/2.png) 27 | -------------------------------------------------------------------------------- /helper.php: -------------------------------------------------------------------------------- 1 | $v) { 23 | if (gettype($v) == 'array') { 24 | foreach ($v as $_v) { 25 | $result[$f][] = convertData($_v); 26 | } 27 | } else if (strpos($v, '&') !== false) { 28 | $result[$f] = convertData($v); 29 | } else if (substr($v, 0, 1) == '[' || substr($v, 0, 1) == '{') { 30 | $t = json_decode($v, true); 31 | if (json_last_error() === JSON_ERROR_NONE) { 32 | $result[$f] = json_decode($v, true); 33 | } 34 | } else { 35 | $result[$f] = $v; 36 | } 37 | 38 | } 39 | return $result; 40 | } 41 | 42 | $tmp = convertData($data); 43 | var_dump($tmp); 44 | ?> 45 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | '.$arr['title'].''; 31 | echo '
'; 32 | echo 'views: '.number_format($arr['view_count']).' channel: '.$arr['author'].'
'; 33 | 34 | if (isset($arr['storyboard_spec'])) { 35 | list($story_url, $l0, $l1, $l2) = explode('|', $arr['storyboard_spec']); 36 | list($p1, $p2, $per_pic, $p4, $p5, $p6, $p7, $sigh) = explode('#', $l2); 37 | $qty = ceil($arr['length_seconds']/$per_pic)+2; 38 | echo 'story board
'; 39 | } 40 | 41 | if (isset($arr['dashmpd'])) { 42 | 43 | $dashmpd = @file_get_contents($arr['dashmpd']); 44 | 45 | if ($dashmpd) { 46 | $xml = new SimpleXMLElement($dashmpd); 47 | $json = json_decode( json_encode($xml), true); 48 | foreach ($json['Period']['AdaptationSet'] as $row) { 49 | echo '

'.$row['@attributes']['mimeType'].'(only)

'; 50 | usort($row['Representation'], function($a, $b) { 51 | if (isset($a['@attributes']['height'])) 52 | return $a['@attributes']['height'] < $b['@attributes']['height']; 53 | return $a['@attributes']['codecs']; 54 | }); 55 | foreach ($row['Representation'] as $item) { 56 | $attr = $item['@attributes']; 57 | echo ''; 58 | 59 | if (isset($attr['codecs'])) 60 | echo 'codecs: '.$attr['codecs'].','; 61 | if (isset($attr['audioSamplingRate'])) 62 | echo 'sample: '.$attr['audioSamplingRate'].','; 63 | if (isset($attr['frameRate'])) 64 | echo 'frame rate: '.$attr['frameRate'].','; 65 | if (isset($attr['height'])) 66 | echo 'res: '.$attr['height'].'p'; 67 | echo '
'; 68 | } 69 | } 70 | } 71 | } 72 | 73 | if (isset($arr['url_encoded_fmt_stream_map']) && isset($arr['url_encoded_fmt_stream_map'][0]) && $arr['url_encoded_fmt_stream_map'][0] != '') { 74 | echo '

mix

'; 75 | foreach ($arr['url_encoded_fmt_stream_map'] as $mix) { 76 | parse_str($mix, $m); 77 | echo ''.$m['type'].','.$m['quality'].'
'; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /screenshot/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagdun/youtube-downloader/3e901faaf27a1d7b0438423341b451ccf949d673/screenshot/1.png -------------------------------------------------------------------------------- /screenshot/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagdun/youtube-downloader/3e901faaf27a1d7b0438423341b451ccf949d673/screenshot/2.png -------------------------------------------------------------------------------- /storyboard.php: -------------------------------------------------------------------------------- 1 |
'; 10 | } 11 | --------------------------------------------------------------------------------