Clean up your teeming reading list.
Clean up your teeming reading list.
Here is the GitHub repo. with the script.
If you are like me, your reading list is overflowing. Mine is over 1000+ entries. I use it daily to quickly remind myself of useful websites I’ve found, but I never bother to clean it up after those sites have used their purpose.
I didn’t want to clean it up manually by clicking through 1000+ items with a mouse is tedious. There is a shortcut to remove all items, but before doing that I wanted to export the data.
Here’s how it’s done.
Your reading list is stored in ~/Library/Safari/Bookmarks.plist
(at least, in Mac 11.4
Big Sur it is). Additionally, icons for the reading list are stored in ~/Library/Safari/ReadingListArchives
.
To read the .plist
file format in Python, it is easiest to use the plistlib library:
pip install plistlib
Here is the complete script — the explanation is below:
python export\_reading\_list.py csv reading\_list.csv
will write the reading list to reading_list.csv
.
python export\_reading\_list.py json reading\_list.json
will write the reading list to reading_list.json
.
python export\_reading\_list.py csv reading\_list.csv — dir-icons-out reading\_list\_icons
copies the icons to the folder reading_list_icons
. They match up to the entries through the WebBookmarkUUID
key.
python export\_reading\_list.py csv reading\_list.csv — dir-icons ~/Library/Safari/ReadingListArchives
The default is ~/Library/Safari/ReadingListArchives
.
.plist
file:python export\_reading\_list.py csv reading\_list.csv — fname-bookmarks ~/Library/Safari/Bookmarks.plist
The default is ~/Library/Safari/Bookmarks.plist
.
python export\_reading\_list.py csv reading\_list.csv — include-data
The data is written to the Data
field. The default is the--exclude-data
option, which excludes the data.
First, copy the plist
file for safety:
Next, find reading list elements in this terribly formatted dictionary:
Convert the reading list dictionaries to custom objects:
Finally, dump the entries to JSON or CSV:
Now we have a backup of the reading list. A future project may write an edited CSV or JSON file back to the reading list plist
format recognized by Safari.
By Oliver K. Ernst, Ph.D. on December 16, 2021.
Exported from Medium on July 24, 2022.