Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8786891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:44:57+00:00 2026-06-13T21:44:57+00:00

I have the following code which is used to load video information from YouTube

  • 0

I have the following code which is used to load video information from YouTube onto my site:

try {
    $yt = new Zend_Gdata_YouTube();
    $videoEntry = $yt->getVideoEntry($video_path);
    $duration = $videoEntry->getVideoDuration();
} catch (Zend_Gdata_App_HttpException $e) {
    //do something with the error
}

The problem I have is that I’ve detected, so far, 2 scenarios where the catch block will be executed – if the video has been removed, or if there is some sort of communication error.

If the video has been removed, I want to remove it from my local listing. How can I tell which error I’m getting – I’ve been looking for a description of the error codes, and can’t find this, though I’m sure other people have run into this issue before.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:44:58+00:00Added an answer on June 13, 2026 at 9:44 pm

    If the video ID you are looking for was deleted or never existed, the HTTP status code for the request will be 400 and the body of the response is Invalid id. You can get the underlying response object to determine if the request was invalid, or if the request failed completely.

    try {
        $yt         = new Zend_Gdata_YouTube();
        $videoEntry = $yt->getVideoEntry($video_path);
        $duration   = $videoEntry->getVideoDuration();
    } catch (Zend_Gdata_App_HttpException $e) {
        $response = $e->getResponse();
    
        if ($response !== null) {
            if ($response->getStatus() == 400 && $response->getBody() == 'Invalid id') {
                // the video requested does not exist or was deleted
            } else {
                // some other error
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code on my site: backgroundImages[bg_img_path_b]=new Image(); backgroundImages[bg_img_path_b].src = bg_img_path_b; backgroundImages[bg_img_path_b].loaded=loading; //jQuery(backgroundImages[lastImage]).unbind('load.backgroundImages');
I have the following code that is used to load user images from a
I have the following code which is used to upload large files (~6MB) to
I have the following code used to avoid a switch statement to decide which
I have the following code that is used to download files from the server,
I have the following code which needs the data to be read from port
I have following code which works for radio buttons but need to be changed
I want to know is below code correct ? I have following code which
I have the following code which definitely returns a proper data result if I
I have the following code which is working, I was wondering if this can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.