Skip to content

Instantly share code, notes, and snippets.

@amdavidson
Created August 1, 2011 03:05
Show Gist options
  • Save amdavidson/1117507 to your computer and use it in GitHub Desktop.
Save amdavidson/1117507 to your computer and use it in GitHub Desktop.
Delicious Parsing
<%
if delicious_enabled == true then
require 'open-uri'
require 'json/ext'
url = "http://feeds.delicious.com/v2/json/#{ENV["delicious_name"]}"
response = open(url, 'User-agent' => 'amdavidson.com').read
links = JSON.parse(response)
for l in links[0...5] do
%>
<li>
<h2><a href="<%= l["u"] %>" title="<%= l["d"]%>" target="_blank"><%= l["d"]%></a></h2>
<p><%= l["n"] %></p>
</li>
<% end
end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment