Created
August 7, 2020 13:02
-
-
Save gerrgg/f04fb87c01082aaceb774a0e5e39ebe2 to your computer and use it in GitHub Desktop.
This file contains 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
function getYoutubeVideoStatus( $video_id ){ | |
/** | |
* Get the status of a youtube video | |
* @param string $video_id | |
* @return string | false | |
*/ | |
$url = "https://www.googleapis.com/youtube/v3/videos?part=status&id=$video_id&key=YOUR_API_KEY_HERE"; | |
$results = json_decode(file_get_contents($url)); | |
return( isset( $results->items[0]->status->privacyStatus ) ) ? $results->items[0]->status->privacyStatus : false; | |
} | |
getYoutubeVideoStatus('imF5oTuALTo'); //false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment