fork download
  1. import Network.HTTP
  2. import qualified Codec.Binary.UTF8.String as UTF8
  3. import Text.HTML.TagSoup
  4. import Control.Monad
  5.  
  6. type URI = String
  7.  
  8. main :: IO ()
  9. main = scrapeTags "http://b...content-available-to-author-only...e.jp/entrylist"
  10.  
  11. openURL :: URI -> IO String
  12. openURL uri = getResponseBody =<< simpleHTTP (getRequest uri)
  13.  
  14. scrapeTags :: URI -> IO ()
  15. scrapeTags uri = (getWebPage uri >>= return . parseTags) >>= (resultTags . filter(~== TagOpen "a" [("class", "entry-link")]))
  16.  
  17. resultTags :: [Tag String] -> IO ()
  18. resultTags entrys = mapM_ putEntry entrys >> putStrLn "\nend"
  19.  
  20. putEntry :: Tag String -> IO ()
  21. putEntry e = putStr $ unlines $ map (`fromAttrib` e) ["title", "href"]
  22.  
  23. getWebPage :: String -> IO String
  24. getWebPage = (liftM UTF8.decodeString) . openURL
  25.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.hs:3:7:
    Could not find module `Text.HTML.TagSoup':
      Use -v to see a list of the files searched for.
stdout
Standard output is empty