The Artima Developer Community
Sponsored Link

Java Buzz Forum
Blogger supports enclosures via the GData API

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
dion

Posts: 5028
Nickname: dion
Registered: Feb, 2003

Dion Almaer is the Editor-in-Chief for TheServerSide.com, and is an enterprise Java evangelist
Blogger supports enclosures via the GData API Posted: Apr 12, 2007 2:41 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by dion.
Original Post: Blogger supports enclosures via the GData API
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Latest Java Buzz Posts
Latest Java Buzz Posts by dion
Latest Posts From techno.blog(Dion)

Advertisement

I am producing a new podcast and since I was using Blogger for the podcast blog, I really wanted to be able to throw enclosures right into the feed.

I had thought that Blogger didn't support enclosures, but I found that this wasn't the case. Although there isn't an area in the UI to upload files to a blog post, the GData Blogger Data API does allow you to attach an enclosure to an entry.

Since the GData API works with Atom feeds, you will need to attach a correct link tag (as opposed to an <enclosure> tag from RSS) to the blog entry that you want to attach the podcast.

E.g. a simple enclosure can be added as

<link rel="enclosure" type="audio/mpeg" title="MP3" href=" http://foo.com/episode2.mp3 " length="19283" />

You can also add other types such as BitTorrent.

To implement adding an enclosure I created a ruby script to do the work called addenclosure.

This script takes a bunch of arguments:

  • Blog ID: If you don't know your blog id, simply go to your feed at http://yourblog.blogspot.com/ /feeds/posts/default and look for the id field. It should look something like tag:blogger.com,1999:blog-4808741160899251111 . The numbers are the id that you need to plug in (4808741160899251111)
  • Entry ID: To find this id, you can either look in the same feed and hunt for the correct entry: <entry><id>tag:blogger.com ,1999:blog-4808741160899251111.post-5004114743910071111</id>... and the numbers after the 'post-' are for the entry (5004114743910071111). You could also view the entry itself and look for the comment feed ( http://yourblog.blogspot.com/feeds/5004114743910071111/comments/default ) or various post links, that have the post id.
  • Enclosure URL: You need to tell the script the location (URL) of the podcast itself ( e.g. http://foo.com/episode2.mp3)
  • Enclosure Length: How big is that file? Let me know.

I fully admit that it is a little ugly to have to scrounge for the various IDs, but once you run this script you can visit the feed to see a brand new enclosure link. Throw this into a podcatcher such as iTunes and Bob's your Uncle.

How the script works

The script itself uses my, alpha quality, GData Ruby library. The library was first factored out of gspreadsheet and consists of:

  • GData::Base: The base library knows how to talk GData, including being able to authenticate to Google and use X-HTTP-Method-Override for HTTP methods such as PUT. It has the low level GET, PUT, POST API that other service specific libraries will build on
  • GData::Blogger: The Blogger code knows how to speak to blogger and get and modify feeds and entries. It includes high level methods such as add_enclosure(..)
  • GData::Spreadsheet: Likewise, the spreadsheet module has high level methods such as add_to_cell and evaluate_cell

Along with the library, scripts are also packaged to show the library usage:

  • addenclosure: what we have been talking about
  • bloggerfeed: view the entire feed
  • gspreadsheet: run formula
  • removeenclosure: nuke an enclosure from an entry

In the future I want to work with more GData folk to have a fully fleshed out API for Ruby-folk to talk to any GData service. A couple of people have already contacted me asking to add features ( e.g. high level support for the new Picassa APIs).

Read: Blogger supports enclosures via the GData API

Topic: Annotations in POJO - a boon or a curse? Previous Topic   Next Topic Topic: Links for 2007-04-07 [del.icio.us]

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use