how to check if a video id exists on youtube

Abanoub

what am trying to do is check if the video entered by the users really exists or not , I have searched a lot and found this : ReRetrieving_Video_Entry , but it looks like it deprecated, so how is it possible using Google APIs Client Library for PHP to check if video exists or not?

Abanoub

I have fixed it using this technique, which doesn't require any use of API:

   $headers = get_headers('https://www.youtube.com/oembed?format=json&url=http://www.youtube.com/watch?v=' . $key);

    if(is_array($headers) ? preg_match('/^HTTP\\/\\d+\\.\\d+\\s+2\\d\\d\\s+.*$/',$headers[0]) : false){
        // video exists

    } else {
        // video does not exist
        echo json_encode(array('Error','There is no video with that Id!'));
    }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I check if a video exists on YouTube, in client side

check whether the youtube video exists or not in Android YoutubePlayer

How to check if the ID exists?

How to parse YouTube video ID?

How to check if YouTube video in iframe ended?

How to check if webview YouTube video player was started

How to check for which country a youtube video is allowed?

how to get youtube player id and stop video

How to get ID of last uploaded video to YouTube?

How to display Youtube 10 Trending Video with video id?

Flutter Dart : How to extract youtube video ID from video URL?

Access YouTube Video URL With YouTube Video ID

How to check if user with a specific ID exists?

How to check if a process id (PID) exists

How I can check if user liked video on youtube?

How can I check if a YouTube video allows embedded play

How do I check if a youtube video is blocked/restricted/deleted

How can I get a Youtube video ID from the Youtube API given the video url?

Only output invalid YouTube ID's from database if video doesn't exists

How does youtube recommender train video_id embedding?

How do I get the YouTube video ID from a URL?

How to get youtube video id from URL with java?

How can I query wikidata with a freebase id from a youtube video?

How to get live video id from YouTube channel

Check if message id exists

C# Using Youtube API - How do I check the last time a particular user uploaded a video to Youtube?

Regular expression for YouTube video Id

regex to extract youtube video id?

Extract YouTube video's id