Download the Videos You’ve Uploaded to YouTube

YouTube lets you download the videos you’ve uploaded to the service, but the feature has a lot of limitations. “You can download MP4s of your own uploads, so as long as they do not have any copyrighted content or an audio track added through the Audio tool.” But that’s not all: “there is a limit of two downloads per hour for downloading your video to MP4. The Download MP4 button will not appear next to your videos if you’ve already downloaded two videos in an hour.”
The limitations are absurd, considering that they are your videos and you’ve uploaded them. There are many services and apps that let you download any YouTube video, but they break YouTube’s terms of services.

Fortunately, Google’s Data Liberation launched a much better feature in Google Takeout: download the original videos you’ve uploaded to YouTube with one click. That’s right, no more limitations, you can download all your videos and it’s the only way to get the original versions, not the videos transcoded by YouTube. “No transcoding or transformation – you’ll get exactly the same videos that you first uploaded. Your videos in. Your videos out,” explains Google.
Hopefully YouTube doesn’t find out about this feature and cripple it with some preposterous limitations.

{ Thanks, Herin. }

YouTube @ the Google Developers Academy

Whether you’re a fledgling developer looking to get started with an API or a skilled developer who wants to learn some new tricks, you’ll find engaging material at the Google Developers Academy. Of particular interest to readers of this blog is the YouTube section, which hosts courses specific to the YouTube APIs.

The first course walks JavaScript developers through the steps needed to embed an <iframe> Player on their page along with a list of chapter titles. It’s perfect when you want to embed a lengthy video that consists of multiple sub-sections, since jumping from section to section is as easy as clicking on predefined links. Check out the live demo of a page with videos from last year’s Google I/O conference to see the player in action.

We will be gradually adding to the YouTube section of the Google Developers Academy, and we’ll announce the new courses on this blog and our YouTube for Developers Google+ page. Stay tuned for more great resources!

Jeff Posnick, YouTube API Team

Build awesome YouTube experiences with new APIs and tools

When we introduced the first YouTube API in 2005, we knew that it would be developers who would help us grow YouTube as a platform for connecting the world through video. At this year’s Google I/O, we’re continuing on with that mission through an entire track dedicated to YouTube, where we’re announcing new APIs and developer tools, as
well as a showcase of some of the most innovative apps built with YouTube.

Make mobile video shine
With mobile video now making up as much as half of all mobile traffic, your mobile experience needs video that’s high quality, fast and sleek. We want to give you the best tools to build these experiences, so we’re previewing the new YouTube Android Player API for high-quality and fluid video playback.

Engage with your communities through video
The next generation of YouTube Direct allows you to engage with your community by having them submit videos which you can then feature in playlists. YouTube Direct Lite is implemented in client-side JavaScript using CORS, and does not require any server-side deployments—adding it to your site is as simple as adding an

MMMmmm…data!Retrieving analytics data for your videos used to mean downloading an archive of CSV files that you then had to process. Now, you can use our new YouTube Analytics API to build custom tools for your data. It’s a RESTful web service that gives you the freedom to request customized reports containing only the data you care about. We’re also giving the YouTube Data API a facelift with new features like universal search and updated client libraries in 8 different languages.

Play, watch and learn from developers like you at Google I/O

We’ll be talking about these new features and other developer tools at Google I/O this week, so check out our sessions and codelabs, download the official Google I/O app, and follow online at At I/O you can also visit with Developer Sandbox companies like Flipboard, Dude Perfect and SONY PlayStation @ Home who are building awesome experiences with YouTube APIs. We’ll also share our sessions on the Google Developers YouTube Channel, and you can always find us on Google+ and our developer forum.

—Amanda Surya, YouTube API Team

YouTube : All Good Things Must Come to an end=

If you enjoy the ability to easily start video playback at a specific time using the start parameter, you may also like being able to stop it early. Here’s an example:

<iframe width="420" height="315" src="" frameborder="0" allowfullscreen></iframe>

The end parameter is a positive integer, and it represents the number of seconds from the beginning of the video. If your friends are not into merengue dancing canines, you can now tease them with short clips of videos like the one below:
–Jarek Wilkiewicz, YouTube API Team

The YouTube Player: Now with 30% More Playlistiness!

When Youtube launched support for lists of videos in the YouTube player in March, it was greeted with a lot of enthusiasm. However, some developers pointed out that at first glance it didn’t look very much like a playlist. In particular, they wanted the list of video thumbnails to be visible all the time.

Well, you guys asked for it, and we listened. If you pass a parameter, showinfo=1, when creating the player, the list of video thumbnails will be permanently visible. Here’s an example:

<iframe width=”560″ height=”315″ src=”” frameborder=”0″ allowfullscreen></iframe>

The corresponding embedded player is shown below:

To see all of the parameters that the YouTube player supports, refer to the documentation. If you have any questions, feel free to post them to the YouTube API Google Group.

—Shannon -jj Behrens, YouTube API Team

YouTube: Unlocking JavaScript’s Potential with CORS

Web developers are accustomed to making magical user experiences with a few lines of elegant JavaScript, but when faced with talking to RESTful services like the YouTube API, the options have been anything but simple. The most common approach relies on a technique known as JSONP, which relied on dynamically inserting a <script> tag on a page and triggering a local callback function with response from an external service. The YouTube API has supported JSONP for a while now, but developers using this approach are probably familiar with its drawbacks: request failures can lead to the JavaScript callback never being triggered, and JSONP can only be used for read-only API calls that don’t require HTTP request headers being set.

A modern alternative to JSONP is Cross-Origin Resource Sharing (CORS), which allows JavaScript developers to make arbitrary HTTP requests (GETs, PUTs, POSTs, etc.) via the standard XMLHttpRequest interface. Not every browser supports the extensions to XMLHttpRequest that support CORS, but if you’re using one that does we have some good news for you: the web servers that host the YouTube Data API now are enabled for CORS support!

This opens up a whole new class of web application integration with YouTube done purely in client-side JavaScript, without any need for running server-side code. To illustrate what’s now possible, take a look at this sample code. When run in a browser that supports CORS, you can authenticate using OAuth 2 and then perform the entire browser-based upload flow entirely from JavaScript. Previously, the portion of the code that POSTed metadata to the YouTube API needed to be run on a web server.

We can’t wait to see what JavaScript developers will build now that the doors to CORS are open. Enjoy!

—Jeff Posnick, YouTube API Team

YouTube’s Topics Experiment

In 2010, YouTube started to test a feature that associated videos with topics. At that time, the experiment tried to improve search results pages by allowing you to find related videos.

YouTube Topics is still available as a separate page that lists the most popular topics and lets you find topic channels like this one.

There’s also an experiment that shows the topic of a video next to the channel’s name and lets you subscribe to the topic. The topic is an automatically generated channel. “We use many different sources to find these topics, including frequently used uploader keywords, common search queries, playlist names, and even sources outside of YouTube such as Wikipedia articles,” explains YouTube’s blog.

Here’s how you can enable this experiment. If you use Chrome, Firefox, Safari, Opera or Internet Explorer 8+, open in a new tab, load:

* Chrome’s JavaScript console (Ctrl+Shift+J)
* Firefox’s Web Console (Ctrl+Shift+K)
* Safari’s Web Inspector (how to do that?)
* Opera Dragonfly (press Ctrl+Shift+I and select the “console” tab)
* IE’s Developer Tools (press F12 and select the “console” tab)

and paste the following code:

document.cookie="VISITOR_INFO1_LIVE=4sBbSJYiyUE; path=/;";window.location.reload();

Then press Enter and close the console.

YouTube Developer : See you at GDC, PyCon and SXSW

YouTube Developer Advocates and Engineers will be presenting next week at GDC, PyCon and SXSW. If you’re coming to any of those conferences, we’d love to meet you. Here is what’s in store at each conference:

Games Developers Conference, San Francisco, March 5-9

PYCON 2012, Santa Clara, March 7-15

SXSW Interactive, Austin, March 9-13

YouTube Tests Google+ Integration

Now that YouTube uses Google Accounts, Google can easily integrate YouTube with other Google services. The latest YouTube redesign made the integration with social networks more prominent and the videos from Google+ are just one click away.

YouTube now tests the header that’s already displayed in Google Search, Gmail, Google Docs and many other Google services. The header shows your Google+ notifications, a box that lets you share videos with other Google+ users and links related to your Google profile.

Right now, the Google+ header is only displayed if you haven’t created a YouTube account and you log in using your Google account (so you don’t have a YouTube username and channel). Obviously, you need to join Google+ to see the new features.

{ Thanks, Michael. }

YouTube: Understanding Playback Restrictions

Have you ever tried to show a user a YouTube video embedded on your site only to find out that they don’t have access to view it? For instance, if you try to play the video below, it’ll say “This video contains content from test_yt_owner, who has blocked it on copyright grounds.” There are many reasons why video playback can be restricted. The user might be in a country where the video is blocked, or the video’s content owner might have decided to block access to the video from all mobile applications.

While we strive to make YouTube content available everywhere, we believe it’s important to give YouTube content owners the ability to control where their videos are viewed, which sometimes means you can’t view videos in a certain country or on a certain device.

With enhanced content controls comes increased complexity. The only foolproof way to determine if a user has access to watch a video is to ask them to try watching it. So, if you’re writing an application and you’d like to prevent users from seeing videos that they don’t have the ability to watch, here are a list of things to check:

1. yt:accessControl

Videos that are available for embedding on third-party applications will have the following:

<yt:accesscontrol action='embed' permission='allowed' />

If you’d like to only search for videos that are embeddable, add format=5 to your query.

Just as a video can be embeddable or not, it can also be syndicatable or not:

<yt:accesscontrol action='syndicate' permission='allowed' />

A video that is embeddable but not syndicatable will play on or on other sites that embed the YouTube player, but may not play on devices such as mobile phones or TVs. If you’d like to learn more about retrieving videos suitable for playback on mobile devices, see the developer’s guide.

2. Geo Restrictions

Some videos may be restricted in certain countries. This restriction applies to where the viewer is located, not where your third-party server is located. For instance, if a video is blocked in the US, it will have the following:

<media:restriction type='country'

When you make a query, you can add a restriction parameter to filter videos that will not be playable by a client with a specific IP or from a specific country.

3. yt:state

It’s also important to check the yt:state of the video in the API response. Even if yt:accessControl indicates that syndication is allowed, yt:state might override it. For example, a video that has limited syndication would have the following:

  <yt:state name='restricted' reasoncode='limitedSyndication'>
    Syndication of this video was restricted by its owner.

You might also see the message, “Syndication of this video was restricted by the content owner.” Hence, even if the uploader allows syndication, the content owner could override that and disallow syndication. For example, this could happen if someone uploads a video that contains a soundtrack that is owned by another content owner.

4. Rentals

Some YouTube videos are rentals. You can tell that they are rentals because they have a media:price tag:

<media:price type='rent' price='1.99' currency='USD' yt:duration='PT2592000S' />

Note that the media:price tag is only included in the response if you use a developer key in the query. If you are building a non-browser based YouTube application where it would be impossible for the user to rent a video, you might want to filter out the rentals. You can do that by passing the parameter paid-content=false.

5. Other Restrictions not Currently Exposed via the API

There are even more subtle restrictions that occasionally come into play. Not all of these are currently queryable via the API. For instance, some videos are only playable on a certain set of domains. As I mentioned above, the only foolproof way to know if a user has access to watch a video is to have them try watching it.

Going back to the video above, you might be wondering why it won’t play. If you look at its video entry:

you’ll see that it’s blocked in all countries:

<media:restriction type='country' relationship='deny'>
  BD BE BF...

Furthermore, both syndication and embedding are disallowed:

<yt:accesscontrol action='embed' permission='denied' />
<yt:accesscontrol action='syndicate' permission='denied' />

Hopefully this short blog post on video playback restrictions will help you write applications that have a better understanding of what videos users can and can’t watch. If you have any questions, you can ask them on our forum.

—Shannon -jj Behrens, YouTube API Team