Skip to content

Instantly share code, notes, and snippets.

@co-dan
Created March 17, 2013 16:03
Show Gist options
  • Save co-dan/5182172 to your computer and use it in GitHub Desktop.
Save co-dan/5182172 to your computer and use it in GitHub Desktop.
Using HXT to parse the OPML file you've exported from Google Reader
import Text.XML.HXT.Core
doc = "/Users/dan/Downloads/greader-takeout/Reader/subscriptions.xml"
type Subscriptions = [(String, String)]
getSites :: ArrowXml a => a XmlTree (String,String)
getSites = isElem
>>> hasAttrValue "type" (=="rss")
>>> getAttrValue "htmlUrl" &&& getAttrValue "xmlUrl"
getSubscriptions :: IO Subscriptions
getSubscriptions = runX $ readDocument [] doc >>> deep getSites
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment