Skip to content

Instantly share code, notes, and snippets.

@kreed131
Created February 12, 2014 20:23
Show Gist options
  • Save kreed131/8963802 to your computer and use it in GitHub Desktop.
Save kreed131/8963802 to your computer and use it in GitHub Desktop.
main = do
html <- getUrl "http://asd.com"
getThreadLinks html
getUrl url = snd <$> curlGetString url curlOpts
getThreadLinks s = do
xs <- runX $ (parseHtml s) >>> css "a" >>> getAttrValue "href"
return $ map ((++) ourUrl2) . extractEvery 3 $ filter (\y -> isInfixOf "threads/" y && isInfixOf "page" y && (not . isInfixOf "http") y) xs
extractEvery m = map snd . filter (\(x,y) -> mod x m == 0) . zip [1..]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment