0

How can I get the date when a video was uploaded via the Youtube API?

 2 years ago
source link: https://www.codesd.com/item/how-can-i-get-the-date-when-a-video-was-uploaded-via-the-youtube-api.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How can I get the date when a video was uploaded via the Youtube API?

advertisements

I'm confused as to where I can find the date a youtube video was uploaded. I've been using the following two functions:

$videoEntry->getUpdated()->getText();
$videoEntry->getVideoRecorded()

The first is when the video was last updated, and I'm not so sure that is the same as when it was uploaded. The "video recorded" is not always present. I assume its taken from camera metadata.

I need the date it was uploaded to the youtube website. Thanks.


From the YouTube API Reference Guide.

"The <yt:uploaded> tag specifies the time that a playlist entry was originally uploaded to YouTube."

If you just browse the feed file for a particular video, such as http://gdata.youtube.com/feeds/api/videos/bTL5bErRk-g, you can see the uploaded date in the "published" tag, near the top:

<entry>
    <id>http://gdata.youtube.com/feeds/api/videos/bTL5bErRk-g</id>
    <published>2009-08-02T13:59:54.000Z</published>
    <updated>2009-10-29T11:20:11.000Z</updated>
...

Whatever 'published' technically means to YouTube, that's my video, and I can confirm that that's when I uploaded it.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK