4

I have a list of several YouTube URLs that I would like to add programmatically to a YouTube playlist (in my channel). (Actually, I have several target playlists in mind, each getting a subset of the URLs in my list.)

Is there a way I can add these programmatically (e.g. with Python or Perl, etc.)?

p.s., (I imagine realize that there's a way to do this using the YouTube API, but my (very limited) understanding of this approach is that it would require me to create and register (with Google) a web app, and it would be this web app that would make API calls. If this picture is correct, it looks like a lot of hassle for what I want to do.)

Edit: By way of clarification:

  1. I am familiar with the info given Adding a video to a playlist, but, as I explained, I am hoping to find some other way to do this.

  2. I have no problem with registering myself to get a developer key, nor I have any problem with including a developer key with every request; but, in principle, including a developer key in one's requests does not require a webapp (a simple script, or even a command-line one-liner, is perfectly adequate, technically speaking, to this task); therefore, the webapp business seems to me an extraneous artifact of Google's registration procedure, one that greatly complicates what would otherwise be a very simple programming task.

  • You can achieve all these from command line. You don't have to have a webapp running. – Bibhas May 10 '12 at 16:55
3

Youtube's API documentation has all the answers. Check the "Adding video to playlist" section. Here is a sample request for the same action -

POST /feeds/api/playlists/PLAYLIST_ID HTTP/1.1
Host: gdata.youtube.com
Content-Type: application/atom+xml
Content-Length: CONTENT_LENGTH
Authorization: Bearer ACCESS_TOKEN
GData-Version: 2
X-GData-Key: key=DEVELOPER_KEY

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom"
    xmlns:yt="http://gdata.youtube.com/schemas/2007">
  <id>VIDEO_ID</id>
  <yt:position>1</yt:position>
</entry>

P.S. -

it looks like a lot of hassle for what I want to do

Using API is the only way to do it programmatically. And to use Google's API, you have to register a developer key to get the access token. You can use python/perl libraries to decrease the headache a bit, but you have to do them.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.