Created
September 7, 2017 14:45
-
-
Save Pum-purum/d32fde0fa36f949bf072fad888d80cc9 to your computer and use it in GitHub Desktop.
Получить название видео на YouTube по его адресу
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$link = parse_url($youTubeRef, PHP_URL_QUERY); | |
$link = substr($link, 2); | |
$key = "AIzaSyC_pztO0mmCmOwe2FaJjF5vZuM80UGLCO8"; | |
$buf = file_get_contents("https://www.googleapis.com/youtube/v3/videos?part=snippet&id=".$link."&key=".$key); | |
$json = json_decode($buf, 1); | |
$title = $json['items'][0]['snippet']['title']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment