Furl2delicious

SnippSnappHome | RecentChanges | Preferences

Here's a small script to import Furl.net bookmarks to del.icio.us. It doesn't take furl categories into account, cause I never bother to categorize my furl bookmarks.

#!/usr/bin/env ruby
#
# run this script like so:
# ruby furl2delicious.rb furl_username delicious_user delicious_password
#  
# requires rubilicious and rubyful_soup
# get them like so:
# gem install rubilicious
# gem install rubyful_soup


require 'uri'
require 'open-uri' 
require 'rubygems'

require_gem 'Rubilicious'
require 'rubyful_soup'



furl_user = ARGV[0]
d_user = ARGV[1]
d_pass = ARGV[2]

puts "furl_user " + furl_user
puts "d_user " + d_user
puts "d_pass " + d_pass

urls = {}
r = Rubilicious.new(d_user,d_pass)
posts = r.posts()
posts.each{|post|
  urls[post['href']] = true
}

puts


furl_url = "http://www.furl.net/search?id=" + furl_user + "&search=browse&count=1000000"
data = URI.parse(furl_url).open.read()

soup = BeautifulStoneSoup.new(data)


rows = soup.find_all ("tr")
rows.each {|row| 
  i = row.td['id']
  if i == "lineBodyBlueAlt" or i == "lineBodyWhtAlt"
    title = row.strong.string.strip
    href =  row.find_all("a")[2].string
    
    puts href
    if urls.has_key?(href)
      puts "we already have this url"
    else
      puts "add"
      r.add(href, title)
    end

    puts
    
  end
  
}


SnippSnappHome | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited April 20, 2006 11:26 am by 81-232-78-86-no46.tbcn.telia.com (diff)
Search: