Skip to content

Instantly share code, notes, and snippets.

@sanderdg
Forked from ktheory/simple-note-backup.rb
Created September 15, 2011 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanderdg/1219742 to your computer and use it in GitHub Desktop.
Save sanderdg/1219742 to your computer and use it in GitHub Desktop.
Script to automatically export simplenote data from http://simplenote-backup.appspot.com/
#!/usr/bin/env ruby
require 'rubygems'
require 'mechanize'
require 'yaml'
config = YAML.load_file(File.expand_path("~/.simple-note-backup.yml"))
email = config['email']
password = config['password']
agent = Mechanize.new
login = agent.get("http://simplenote-export.appspot.com/").form("loginform")
login.email = email
login.password = password
export_form = agent.submit(login, login.buttons.first).form("export")
export_form.radiobuttons_with(:value => 'txt').first.check
agent.submit(export_form, export_form.buttons.first).body
pickup = agent.get("http://simplenote-export.appspot.com/pickup").form("loginform")
pickup.email = email
pickup.password = password
pickup_form = agent.submit(pickup, pickup.buttons.first).form("serveexport")
download = agent.submit(pickup_form, pickup_form.buttons.first).body
puts download
@sanderdg
Copy link
Author

Updated the version of ktheory so that it works again; my first script in Ruby :)

@mishamazor
Copy link

Hi there,
Super beginner here. What's the easiest way to run this?

Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment