Google Reader export to bookmarks.htm

I was one of the small group of Google Reader users who actively used the sharing functionality before Google killed it with their latest upgrade. While the number of people I shared with was small, the quality was incredibly high. I don’t blame Google for wanting to consolidate their social graphs (makes sense to me), but I will miss the conversations I had there.

A friend asked me if I knew how to export the shared items JSON file to a standard bookmarks.htm file. I didn’t, but I managed to whip up a quick PHP script to do the trick. Here’s the code for anyone who is interested.


// bump this limit up as it can be quite memory intensive if you have a lot of shared items
ini_set('memory_limit', '64M');

// update to use your own file here
$json_file = "/tmp/shared-items.json";

// output the std header
echo <<< EOT
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

$json = json_decode(file_get_contents($json_file));
echo "<DL>\n\t<DT>";
foreach ($json->items as $item) {
    echo '\t<A HREF="'.$item->alternate[0]->href.'" ADD_DATE="'.$item->published.'" LAST_VISIT="'.round($item->crawlTimeMsec/1000).'" LAST_MODIFIED="'.$item->updated.'">'.utf8_decode($item->title).'</A>\n';
echo "</DL>";

  • That's awesome! Thanks! 🙂

  • Anyone else find that it only captured a portion of them? In my case only back to July…

  • The export tool in not under file in Firefox 4.0. It is controlled from the bookmarks menu under "show all bookmarks". Since your post is coming up in searches toward the top, you may want to revise it.

  • Nicholai

    I ran this script in the terminal in Ubuntu, and it worked and everything, but where does it put the .html file in the end?