Skip to content

Instantly share code, notes, and snippets.

@wilbeibi
Last active April 3, 2021 18:10
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wilbeibi/489ae95d625733b726e0d562c55b761d to your computer and use it in GitHub Desktop.
Save wilbeibi/489ae95d625733b726e0d562c55b761d to your computer and use it in GitHub Desktop.
Export Reeder starred iterms to csv
#!/usr/bin/env python3
import getpass
import sqlite3
import csv
RKIT_PATH = "/Users/" + getpass.getuser() + "/Library/Containers/com.reederapp.rkit2.mac/Data/Library/Application Support/Reeder/rkit/"
conn = sqlite3.connect(RKIT_PATH + "rkit.db")
DATA_DB_PATH = RKIT_PATH + "rkit-data.db"
cursor = conn.cursor()
cursor.execute("ATTACH DATABASE '%s' AS data" % DATA_DB_PATH)
cursor.execute('''
SELECT data.rkitemdata.title, data.rkitemdata.link, data.rkitemdata.content FROM data.rkitemdata
INNER JOIN rkitem
WHERE data.rkitemdata.id == rkitem.id and rkitem.starred == 1
''')
data = cursor.fetchall()
with open("starred_items.csv", "w") as f:
writer = csv.writer(f)
for row in data:
writer.writerow(row)
@ruanjf
Copy link

ruanjf commented Nov 11, 2017

import sys
reload(sys)
sys.setdefaultencoding('utf-8')

for python2.7 not ascii content

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