I've been searching on how to get a YouTube video's uploader and found that I had to use YouTube Data v3 API.
The thing is: I don't want to use any API key nor have any kind of restrictions while performing queries. Is there any way to do so?
I've been searching on how to get a YouTube video's uploader and found that I had to use YouTube Data v3 API.
The thing is: I don't want to use any API key nor have any kind of restrictions while performing queries. Is there any way to do so?
Yes, get_video_info is available so you can read the needed information from it. There is no official documentation for it, though.
function ParseQueryString($query)
{
$query = iconv(mb_detect_encoding($query, mb_detect_order(), true), "UTF-8", $query);
$params = explode('&', $query);
$args = array();
foreach ($params as $param)
{
$value = explode('=', $param);
$args[$value[0]] = $value[1];
}
return $args;
}
function GetArgs($args, $key, $query)
{
$iqs = strpos($args, $query);
$querystring = "";
if ($iqs != -1)
{
$querystring = ($iqs < strlen($args) - 1) ? substr($args, $iqs + 1) : "";
$nvcArgs = ParseQueryString($querystring);
return $nvcArgs[$key];
}
return "";
}
function GetVideoUploader($url)
{
$id = GetArgs($url, "v", '?');
return GetArgs(file_get_contents("http://youtube.com/get_video_info?video_id=" . $id), "author", '&');
}
The function GetVideoUploader first retrieves the videoID from the input URL and then uses the videoID to get the video author (aka uploader). GetArgs function can also be used for retrieving a lot of other information from a YouTube video and without need for an API key, such as: download link, length, title, thumbnail and much more. The GetArgs function needs the output from get_video_info in $args, the parameter what you want to find in $key and the '&' symbol in $query.
You can get a list of parameters by accessing http://youtube.com/get_video_info?video_id=iNJdPyoqt8U (as example), opening it with Notepad++ and replacing '&' character by ' '.