to Wordpress

I’ve just uploaded a new project on Github called delicious_wp: it’s a small Ruby script that simply fetches the items stored in the previous week and creates a blog post with them. You can set up a small cron job to execute this script every week, which is what I’ve done for this blog :) I know has a similar feature integrated, but it executes daily, instead of weekly, which is what I wanted.

To use it, just clone the repository, copy the config.yaml.sample file as config.yaml and edit its values inside. Run the script and voilĂ ! A new blog post entry with your bookmarks.

The script can also be helpful to those wondering how to use the XML-RPC interface of WordPress from a Ruby script, or how to use the Net::HTTP library to consume a REST API.

def get_delicious_bookmarks
  # Connect to delicious and get updates
  http.use_ssl = true
  req =
  req.add_field("User-Agent", DELICIOUS_USER_AGENT)
  req.basic_auth username, password
  response = http.request(req)
  results = response.body
def post_to_wordpress(title, text)
  entry = {
    :title => title,
    :description => text
  # Connect to Wordpress using the XML-RPC interface
  blog =, path, port)"metaWeblog.newPost", blogid, username,
                            password, entry, true)

Enjoy! As usual, the code is released with a BSD license.