blob: a20618109a949032642f6b91d6748afd9fbb3ac0 (
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
|
module FetchAd
( leboncoin
, ouestFrance
, seLoger
) where
import Data.Either (rights)
import Data.Text.Encoding as T
import Model.Ad (Ad)
import Model.URL (URL)
import qualified Parser.LeboncoinParser as LeboncoinParser
import qualified Parser.OuestFranceParser as OuestFranceParser
import qualified Parser.SeLogerParser as SeLogerParser
import qualified Utils.HTTP as HTTP
leboncoin :: [URL] -> IO [Ad]
leboncoin urls =
fmap (concat . map LeboncoinParser.parse . rights)
. sequence
. map (HTTP.get T.decodeLatin1)
$ urls
ouestFrance :: [URL] -> IO [Ad]
ouestFrance urls =
fmap (concat . map OuestFranceParser.parse . rights)
. sequence
. map (HTTP.get T.decodeUtf8)
$ urls
seLoger :: [URL] -> IO [Ad]
seLoger urls =
fmap (concat . map SeLogerParser.parse . rights)
. sequence
. map (HTTP.get T.decodeUtf8)
$ urls
|