Created
February 21, 2012 03:02
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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