Quantcast
Channel: How to backup and access iOS Safari's reading list? - Ask Different
Viewing all articles
Browse latest Browse all 2

Answer by fzbd for How to backup and access iOS Safari's reading list?

$
0
0

Assuming you have your backup under $backup_dir, the reading list is stored in the sqlite database file $backup_dir/Library/Safari/Bookmarks.db, under the table bookmarks.

This table also contains favourites, which can be distinguished from reading list bookmarks by the fact they have no value for the column extra_attributes. Therefore, we can use the following query:

select url,titlefrom bookmarkswhere url not like '' and extra_attributes not like '';

To import these in browsers, we can transform the entries into Netscape Bookmark File Format. You can use, for example, the following AWK script:

#!/usr/bin/awk -fBEGIN { print \"<!DOCTYPE NETSCAPE-Bookmark-file-1>\n" \"<!--This is an automatically generated file.\n" \"It will be read and overwritten.\n" \"Do Not Edit! -->\n" \"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">\n" \"<TITLE>Bookmarks</TITLE>\n" \"<H1>Bookmarks</H1>\n" \"<DL><p>"}/^[[:space:]]*$/ { next }{    split($0, parts, "|")    url = parts[1]    title = separator = ""    for (i=2; i in parts; i++) {        title = title separator parts[i]        separator = "|"    }    print "<DT><A HREF=\"" url "\">" title "</A>"}END { print "</DL><p>" }

In sum, you can do all this with the following bash "one-liner":

echo "select url,titlefrom bookmarkswhere url not like '' and extra_attributes not like '';" | \sqlite "$backup_dir"/Library/Safari/Bookmarks.db | \./"$awk_script"> bookmarks.html

Viewing all articles
Browse latest Browse all 2

Trending Articles