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

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: 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

YouTube Tests a New Interface

YouTube experiments with a new interface that uses a gray background, muted colors, redesigned buttons and new icons for the like/dislike buttons. Most of the features are available in the Cosmic Panda experiment, but the changes are less drastic.

To try the new interface, change the value of the VISITOR_INFO1_LIVE cookie for to Eg7GsyKWzk8. For example, in Google Chrome, go to YouTube’s homepage, open the JavaScript console (Ctrl+Shift+J or Menu > Tools > JavaScript Console), paste the following code:


Then press Enter, close the console and reload YouTube’s homepage.

You can also use extensions like Edit this cookie (Chrome) or Cookies Manager (Firefox). Opera has a powerful cookie manager, so you don’t need an extension to edit a cookie.

To go back to the old interface, open your browser’s cookie manager, search for and delete the VISITOR_INFO1_LIVE cookie.

{ Thanks, Maurice. }

YouTube: Support for the Watch Later List

YouTube’s Watch Later list is the perfect way to keep track of interesting videos you come across but don’t have time to watch at the moment. Since rolling out that feature on the YouTube website and the embedded players, developers have been asking for ways to interact with the Watch Later list via the YouTube Data API. We’re happy to announce that this is now possible.

As explained in our documentation, the YouTube Data API treats the Watch Later list like a playlist, and the normal playlist operations (additions, retrievals, modifications) can all be performed on the Watch Later list. While every YouTube user has their own Watch Later list, it’s important to keep in mind that by default it’s a private playlist, so it will not normally be accessible unless you’re making an authenticated request as the list’s owner.

If you have any questions about using the Data API to work with the Watch Later list, please let us know in our developer forum.

—Jeff Posnick, YouTube API Team

Tutorial : How to Get 3D Content on YouTube

Over the last few months, we’ve been steadily rolling out features for YouTube 3D. Early this year, we announced support for the LG Optimus 3D and NVIDIA 3D Vision, and this month we announced support for Samsung 3D TVs. And we’ll keep rolling out to more platforms to make it easier for everyone to get access to user-generated 3D content.
Many readers have been asking how to upload content. 3D uploads to YouTube will work across all supported devices, from red/blue glasses to the latest 3D televisions.
There are two ways to upload content to YouTube in 3D. If you’re just uploading one or two videos, upload content in any supported format and then edit the video settings to tell us that it’s 3D. From a video’s watch page, select “edit info”, then “3D Video”. This will only work on videos you’ve uploaded yourself.
If you’re using the API to upload 3D videos, you’ll want to format your video in a certain way. YouTube supports automatic detection of 3D content with certain file formats. If you upload with a format that supports automatic detection, we’ll automatically set the correct settings so that your video shows up automatically in 3D and shows up properly on phones, TVs, and PCs.
In both cases, YouTube requires that content be uploaded in Side by Side L/R with each frame squashed 50% and preferably with a 16:9 aspect ratio. The following formats are automatically detected when uploaded:
  • WebM with the StereoMode setting set to STEREOMODE_TYPE_LEFT_RIGHT. Note that other modes, including alternate track, are not supported.
  • H264 AVC with Supplementary Enhancement Information, Frame Packing Arrangement set. If you are usingx264, the argument --frame-packing=3 will set this correctly. In Handbrake you can set this in “x264 Advanced Option String”.

Be sure to get the squashing and positioning exactly correct. 3D content won’t look right if video formatting is off by even a pixel or two.

YouTube: Coming Soon: The Dark Player for Embeds

You may have noticed that we’ve changed the look of the player on YouTube. You may even have noticed that we’ve been experimenting with changing the look of embedded players too. Coming up on August 10, all embeds will automatically be updated to the new “dark player”:

Although we’re very excited about this change, which comes after months of design, research, and experimentation, we realize that some embedders would prefer a lighter color to match a lighter webpage, so we’re also announcing a few other themes that we’ll be making available. We also realize that some embedders would prefer something more mild than our use of red, so we’re happy to introduce a “desaturated” color option without any bright colors at all. (Note: Using the desaturated color disables the modestbranding option.)

To pick an alternate theme, pass in values for the “theme” and “color” player parameters. For instance, if you’d like to keep the traditional colors, you can pass parameters such as:

Here are all the new themes, including the new default:

If you have any questions about this change, you can ask them on our forum.

—Shannon -jj Behrens, YouTube API Team