Skip to content

Instantly share code, notes, and snippets.

@lotz84
Created July 21, 2015 03:27
Show Gist options
  • Save lotz84/26ce3f3d29342876ceda to your computer and use it in GitHub Desktop.
Save lotz84/26ce3f3d29342876ceda to your computer and use it in GitHub Desktop.
web page 内のリンク先URLを列挙する
{-# LANGUAGE OverloadedStrings #-}
import Control.Lens
import Data.Foldable
import Network.Wreq
import Text.Taggy.Lens
import Data.Text.Lazy.Encoding
import Data.Maybe
main = do
r <- get "URL"
traverse_ print . catMaybes $ (r ^.. responseBody . to decodeUtf8 . html . allNamed (only "a") . attrs . at "href")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment