1,7 → 1,7 |
<?php |
|
// ViaThinkSoft YouTube Downloader Functions 2.1 |
// Revision: 2021-07-15 |
// Revision: 2021-05-09 |
// Author: Daniel Marschall <www.daniel-marschall.de> |
// Licensed under the terms of the Apache 2.0 License |
|
49,8 → 49,6 |
$obj = json_decode($cont, true); |
if (!$obj) return false; |
|
if (!isset($obj['items'])) return false; |
|
foreach ($obj['items'] as $item) { |
if ($item['snippet']['resourceId']['kind'] == 'youtube#video') { |
$title = $item['snippet']['title']; |
73,8 → 71,6 |
$obj = json_decode($cont, true); |
if (!$obj) return false; |
|
if (!isset($obj['items'])) return false; |
|
foreach ($obj['items'] as $item) { |
if ($item['kind'] == 'youtube#channel') { |
return $item['id']; |
89,8 → 85,6 |
$obj = json_decode($cont, true); |
if (!$obj) return false; |
|
if (!isset($obj['items'])) return false; |
|
foreach ($obj['items'] as $item) { |
if ($item['kind'] == 'youtube#channel') { |
return array($item['id'], $item['statistics']); |
105,8 → 99,6 |
$obj = json_decode($cont, true); |
if (!$obj) return false; |
|
if (!isset($obj['items'])) return false; //totalResults could be 0 |
|
foreach ($obj['items'] as $item) { |
if ($item['kind'] == 'youtube#channel') { |
return $item['statistics']; |
121,8 → 113,6 |
$obj = json_decode($cont, true); |
if (!$obj) return false; |
|
if (!isset($obj['items'])) return false; |
|
foreach ($obj['items'] as $item) { |
if ($item['kind'] == 'youtube#playlist') { |
return $item['contentDetails']; |
142,8 → 132,6 |
$obj = json_decode($cont, true); |
if (!$obj) return false; |
|
if (!isset($obj['items'])) return false; |
|
foreach ($obj['items'] as $item) { |
if ($item['id']['kind'] == 'youtube#video') { |
$title = $item['snippet']['title']; |
172,8 → 160,6 |
$obj = json_decode($cont, true); |
if (!$obj) return false; |
|
if (!isset($obj['items'])) return false; |
|
foreach ($obj['items'] as $item) { |
if ($item['id']['kind'] == 'youtube#video') { |
$title = $item['snippet']['title']; |
196,7 → 182,7 |
$m = null; |
|
# Usual format |
if (($vid === false) && (preg_match("@https{0,1}://(www\\.|)youtube\\.com/watch(.*)(/|&|\\?)v=([a-zA-Z0-9_-]{11})@ismU", $url, $m))) { |
if (($vid === false) && (preg_match("@https{0,1}://(www\\.|)youtube\\.com/watch(.*)(&|\\?)v=([a-zA-Z0-9_-]{11})@ismU", $url, $m))) { |
$vid = $m[4]; |
} |
|
218,7 → 204,7 |
|
# Usual format |
$m = null; |
if (($pid === false) && (preg_match("@https{0,1}://(www\\.|)youtube\\.com/(.*)(/|&|\\?)list=(.+)&@ismU", $url.'&', $m))) { |
if (($pid === false) && (preg_match("@https{0,1}://(www\\.|)youtube\\.com/(.*)(&|\\?)list=(.+)&@ismU", $url.'&', $m))) { |
$pid = $m[4]; |
} |
|