aboutsummaryrefslogtreecommitdiff
path: root/app/diff-lists-contacts/Main.hs
blob: 671100c39f4866264b090e387d21203dcafc5b1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{-# 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 = ""
    , oauthConsumerSecret = ""
    }

credential :: Credential
credential = Credential
    [ ("oauth_token", "")
    , ("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):"
    listMembers <- runConduit $
      sourceWithMaxId twInfo mgr (listMembers (ListNameParam "user/someList"))
      .| (CL.isolate 200)
      .| (mapC (\user -> do
                   user ^. userId))
      .| sinkList

    mapM_ (putStrLn . show) listMembers