Skip to content

Instantly share code, notes, and snippets.

@matiaskorhonen
Created August 23, 2014 10:20
Show Gist options
  • Save matiaskorhonen/0712e4c568aab01a3861 to your computer and use it in GitHub Desktop.
Save matiaskorhonen/0712e4c568aab01a3861 to your computer and use it in GitHub Desktop.
A simple script for copying bookmarks from Kippt to Pinboard. Tries to retain as much data as possible (title, list, creation date, and notes). Works for me, might not work for you if you have > 200 clips per Kippt list.
require "kippt" # gem install kippt
require "pinboard" # gem install pinboard
kippt = Kippt::kippt.new(username: "matias", password: "…")
pinboard = Pinboard::kippt.new(username: "matias", password: "…")
lists = kippt.lists.fetch
counter = 0
lists.each_with_index do |list, index|
attrs = list.attributes
list_title = attrs.title
list_slug = attrs.slug
puts "=> Found list: #{attrs.slug}"
clips = list.clips.fetch(limit: 200)
clips.each_with_index do |clip|
counter += 1
cattrs = clip.attributes
url = cattrs.url
title = cattrs.title
description = cattrs.notes
date = Time.strptime(cattrs.created.to_s, "%s")
puts " -> Adding clip ##{counter}"
puts " #{cattrs.id} (#{title}) [#{date}]"
pinboard.add(url: url, description: title, extended: description, tags: [list_slug], dt: date, replace: true)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment