Backup your CiteULike library using MongoDB and Ruby

Well, that was easy.

require "rubygems"
require "mongo"
require "json/pure"
require "open-uri"

db  ='citeulike')
col = db.collection('articles')
j   = JSON.parse(open("").read)

j.each do |article|
  article[:_id] = article['article_id']

2 thoughts on “Backup your CiteULike library using MongoDB and Ruby

  1. Just to note (for others) that this isn’t really a proper backup as there isn’t a way to get the data back into CiteULike. A much better way would be to simply download the BibTeX. This has many advantages, especially that it can be used to restore your library (though not PDFs). SyncUThink (q.v.) is a good way to backup your PDFs.

    • Right, backup is not the correct term: perhaps “partial record of your library” would be better. I think it’s a fun and useful “quick hack”.

Comments are closed.