数百とか開いているSafariのタブ情報をエクスポートする方法【実際にやってみた】
経緯
つまりはこういうことだ。
開きすぎる癖があって、これをどうにかしてCSVなりに書き出したかった。
あなたもこういう癖あったりしませんか?
iPhoneのストレージも逼迫するし。
探していたところ
かみさーまー みたいな記事を発見した。BOOOM!!!
Ok!!! This has been SOLVED. For those who were wondering...
The post request to https://p58-ckdatabase.icloud.com/api/client/record/sync contained gzip-encoded information which made reference to SafariBookmarksSyncAgent.
SafariBookmarksSyncAgent is located at /System/Library/CoreServices/SafariSupport.bundle/Contents/MacOS/SafariBookmarksSyncAgent.
Ran strings on the binary and saw it made reference to: (allow file* (home-literal "/Library/Safari/CloudTabs.db"))
/Library/Safari/CloudTabs.db does not exist, but ~/Library/Safari/CloudTabs.db does!
CloudTabs.db is a SQLite3 database with table cloud_tabs and cloud_tab_devices.
select * from cloud_tab_devices gives the device_uuid in column 1.
select url from cloud_tabs where device_uuid='
'; BOOM!
Reddit - mac - iPhone Safari Tabs into Text List via iCloud?
実際にやってみた
ターミナルでSafariのブックマークの同期をするエージェントを動かす。
/System/Library/CoreServices/SafariSupport.bundle/Contents/MacOS/SafariBookmarksSyncAgent
SQLite なデータベース
~/Library/Safari/CloudTabs.db
を見つけて開くデータベースの中身はこんな感じ
cloud_tabs テーブルの中身に目的のiPhoneで開いている数百のタブのリストがある!
クエリを叩く
select title, url from cloud_tabs
CSVに書き出して完了!!
まとめ
意外と簡単にiPhoneで開いている数百のタブの情報がCSVでエクスポートできた!!
これでiPhoneのストレージの容量が減らせるぜ