Skip to content

Instantly share code, notes, and snippets.

@iamamused
Created February 21, 2012 03:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamamused/1873286 to your computer and use it in GitHub Desktop.
Save iamamused/1873286 to your computer and use it in GitHub Desktop.
Export Mail.app RSS feeds to an OPML file suitable for Google Reader
<?php
$username = 'jsambells';
$opml = '<?xml version="1.0" encoding="ISO-8859-1"?>
<opml version="1.0">
<head>
<dateCreated>'.date('d-M-Y').'</dateCreated>
</head>
<body>
';
foreach (glob("/Users/" . $username. "/Library/Mail/RSS/*/Info.plist") as $plist) {
$xml = new SimpleXmlElement(file_get_contents($plist));
$results = $xml->xpath('//plist/dict[1]/key[.="RSSFeedURLString"]/following-sibling::*[1]/text()');
$url = (string)$results[0][0];
$opml .= '<outline type="rss" xmlUrl="' . $url . '"/>' . "\n";
}
$opml .= '
</body>
</head>
';
file_put_contents( "MailAppToGoogleReader.opml", $opml );
echo "done!";
`open .`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment