Skip to content

Instantly share code, notes, and snippets.

@YPares
Created April 6, 2012 18:40
Show Gist options
  • Save YPares/2321986 to your computer and use it in GitHub Desktop.
Save YPares/2321986 to your computer and use it in GitHub Desktop.
JV.com last tests
import Text.XML.HXT.Core
import Text.XML.HXT.HTTP
import Data.List (isInfixOf)
import Data.String.EncodingNames (isoLatin1)
loop [] = return ()
loop (date:title:plat:xs) = putStrLn (date ++ title ++ " " ++ plat) >> loop xs
main = runX ( readDocument [ withParseHTML yes, withHTTP [], withInputEncoding isoLatin1 ] "http://www.jeuxvideo.com/tests.htm"
//> (hasName "li" </ (hasName "a" `guards` hasAttrValue "href" ("test.htm" `isInfixOf`)))
/> (hasName "strong" <+> hasName "a") /> getText
) >>= loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment