IOS – How to backup and access iOS Safari’s reading list

iosiphonemobile-safarireading-listsafari

I have an iPhone, with iOS 7. In Safari, I have a lot of pages saved in the reading list.

How can I backup the reading list to a computer and then access it ?

On a PC, I have a backup of my iPhone. I have explored the backup with iBackup Viewer, free version, on Windows. I have managed to access the open tabs of Safari. But I don't find the reading list.

Best Answer

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,title
from bookmarks
where 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 -f

BEGIN { 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,title
from bookmarks
where url not like '' and extra_attributes not like '';
" | \
sqlite "$backup_dir"/Library/Safari/Bookmarks.db | \
./"$awk_script" > bookmarks.html