Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import json
import sqlite3
import zlib
# ~/Library/Safari/CloudTabs.db
# Ref: https://www.reddit.com/r/mac/comments/89qx5n/iphone_safari_tabs_into_text_list_via_icloud/
db = sqlite3.connect('CloudTabs.db')
tabs = []
# Ref: https://gist.github.com/mems/2c96233708c6b5b44ed1a26cb0ec5a0e
for row in db.execute('SELECT position,url,title FROM cloud_tabs'):
jsonstr = json.loads(zlib.decompress(str(row[0])))
tabs.append([ jsonstr['sortValues'][0]['sortValue'], row[1], row[2] ])
for row in sorted(tabs, key=lambda k: k[0]):
print row[1].encode('utf-8') + " | " + row[2].encode('utf-8')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.