Created
November 6, 2018 06:24
-
-
Save christianchristensen/76dde5fd8c5b187495372ffa189bf5e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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