Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scintill/2504930 to your computer and use it in GitHub Desktop.
Save scintill/2504930 to your computer and use it in GitHub Desktop.
Convert Google Reader exported JSON of starred items to a Bookmark HTML file for importing in browser
<?php
ini_set('date.default_timezone', 'America/Denver');
?>
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 ADD_DATE="0" LAST_MODIFIED="<?=time()?>">Google Reader Starred Items</H3>
<DL><p>
<?php
$items = json_decode(file_get_contents('starred-items.json'))->items;
foreach ($items as $item) {
?><DT><A HREF="<?=htmlentities($item->alternate[0]->href, null, 'UTF-8')?>" ADD_DATE="<?=substr($item->timestampUsec, 0, -6)?>"><?=htmlentities($item->title, null, 'UTF-8')?></A><?php
echo "\n";
}
?></DL>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment