{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE FlexibleContexts #-} module Main where import Web.Twitter.Conduit import Web.Twitter.Types.Lens import Control.Lens import Conduit import qualified Data.Conduit.List as CL tokens :: OAuth tokens = twitterOAuth { oauthConsumerKey = "YOUR_OAUTH_CONSUMER_KEY" , oauthConsumerSecret = "YOUR_OAUTH_CONSUMER_SECRET" } credential :: Credential credential = Credential [ ("oauth_token", "YOUR_OAUTH_TOKEN") , ("oauth_token_secret", "YOUR_OAUTH_TOKEN_SECRET") ] twInfo :: TWInfo twInfo = def { twToken = def { twOAuth = tokens, twCredential = credential } , twProxy = Nothing } main :: IO () main = do mgr <- newManager tlsManagerSettings putStrLn $ "# your home timeline (up to 200 tweets):" destroyReqs <- runConduit $ sourceWithMaxId twInfo mgr (userTimeline (ScreenNameParam "someUser")) .| (CL.isolate 200) .| (mapC (\status -> do status ^. statusId)) .| (mapC destroyId) .| (mapC (\req -> do callWithResponse twInfo mgr req)) .| sinkList resp <- sequence destroyReqs mapM_ (putStrLn . show) resp