aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris2018-06-19 13:47:24 +0200
committerJoris2018-06-19 13:47:24 +0200
commit5d921c9a2b0a7a8f1a1bb5642cbefa516cbbe4cc (patch)
treed9671a8b8f29ee6c8743f9fa1ab3d701bab8dcce
parent318292532a877c308403c45795d229fad659d900 (diff)
downloadad-listener-5d921c9a2b0a7a8f1a1bb5642cbefa516cbbe4cc.tar.gz
ad-listener-5d921c9a2b0a7a8f1a1bb5642cbefa516cbbe4cc.tar.bz2
ad-listener-5d921c9a2b0a7a8f1a1bb5642cbefa516cbbe4cc.zip
Fix seLoger url
-rw-r--r--src/parser/haskell/Parser/SeLogerParser.hs2
-rw-r--r--src/test/haskell/Main.hs40
2 files changed, 21 insertions, 21 deletions
diff --git a/src/parser/haskell/Parser/SeLogerParser.hs b/src/parser/haskell/Parser/SeLogerParser.hs
index dc2a5c2..b073862 100644
--- a/src/parser/haskell/Parser/SeLogerParser.hs
+++ b/src/parser/haskell/Parser/SeLogerParser.hs
@@ -21,4 +21,4 @@ parseAd tags = do
location <- getTagTextAfter "<div class=c-pa-city>" tags
let price = getTagTextAfter "<span class=c-pa-cprice>" tags
url <- getTagAttribute "<a>" "href" tags
- return (Ad name location price (T.concat ["https:", url]))
+ return (Ad name location price url)
diff --git a/src/test/haskell/Main.hs b/src/test/haskell/Main.hs
index ba09b78..fa86d27 100644
--- a/src/test/haskell/Main.hs
+++ b/src/test/haskell/Main.hs
@@ -100,26 +100,26 @@ main = do
it "should parse ads from page" $ do
let ads =
- [ Ad {name = "Appartement", location = "Paris 20ème", price = Just "1 219 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-20eme-75/plaine/134448375.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 16ème", price = Just "1 500 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-16eme-75/muette-sud/134049627.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 3ème", price = Just "1 595 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-3eme-75/arts-et-metiers/76038037.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 15ème", price = Just "1 612 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-15eme-75/citroen-boucicaut/135038561.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 16ème", price = Just "1 650 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-16eme-75/auteuil-sud/133027227.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 16ème", price = Just "1 875 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-16eme-75/chaillot/127190787.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 8ème", price = Just "1 985 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-8eme-75/saint-philippe-du-roule/127109353.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 1er", price = Just "2 090 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-1er-75/ile-de-la-cite/133982099.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 16ème", price = Just "2 240 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-16eme-75/porte-dauphine/118523093.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 17ème", price = Just "2 400 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-17eme-75/champerret-berthier/134621503.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 6ème", price = Just "2 055 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-6eme-75/saint-germain-des-pres/130192167.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 14ème", price = Just "1 300 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-14eme-75/jean-moulin-porte-d-orleans/133269543.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 16ème", price = Just "3 500 €", url = "https:https://www.bellesdemeures.com/annonces/locations/appartement/paris-16eme-75/133260359.htm?bd=CartoToList_SL&furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&cmp=INTSL_ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 17ème", price = Just "1 890 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-17eme-75/134972009.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 18ème", price = Just "1 390 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-18eme-75/clignancourt-jules-joffrin/134735501.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 6ème", price = Just "1 600 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-6eme-75/saint-germain-des-pres/134437989.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 11ème", price = Just "1 980 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-11eme-75/bastille-popincourt/134314607.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 13ème", price = Just "901 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-13eme-75/olympiades-choisy/134428153.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 12ème", price = Just "1 250 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-12eme-75/aligre-gare-de-lyon/133908165.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
- , Ad {name = "Appartement", location = "Paris 17ème", price = Just "1 100 €", url = "https:https://www.seloger.com/annonces/locations/appartement/paris-17eme-75/legendre-levis/134131479.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ [ Ad {name = "Appartement", location = "Paris 20ème", price = Just "1 219 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-20eme-75/plaine/134448375.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 16ème", price = Just "1 500 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-16eme-75/muette-sud/134049627.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 3ème", price = Just "1 595 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-3eme-75/arts-et-metiers/76038037.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 15ème", price = Just "1 612 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-15eme-75/citroen-boucicaut/135038561.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 16ème", price = Just "1 650 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-16eme-75/auteuil-sud/133027227.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 16ème", price = Just "1 875 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-16eme-75/chaillot/127190787.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 8ème", price = Just "1 985 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-8eme-75/saint-philippe-du-roule/127109353.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 1er", price = Just "2 090 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-1er-75/ile-de-la-cite/133982099.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 16ème", price = Just "2 240 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-16eme-75/porte-dauphine/118523093.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 17ème", price = Just "2 400 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-17eme-75/champerret-berthier/134621503.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 6ème", price = Just "2 055 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-6eme-75/saint-germain-des-pres/130192167.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 14ème", price = Just "1 300 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-14eme-75/jean-moulin-porte-d-orleans/133269543.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 16ème", price = Just "3 500 €", url = "https://www.bellesdemeures.com/annonces/locations/appartement/paris-16eme-75/133260359.htm?bd=CartoToList_SL&furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&cmp=INTSL_ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 17ème", price = Just "1 890 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-17eme-75/134972009.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 18ème", price = Just "1 390 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-18eme-75/clignancourt-jules-joffrin/134735501.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 6ème", price = Just "1 600 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-6eme-75/saint-germain-des-pres/134437989.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 11ème", price = Just "1 980 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-11eme-75/bastille-popincourt/134314607.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 13ème", price = Just "901 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-13eme-75/olympiades-choisy/134428153.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 12ème", price = Just "1 250 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-12eme-75/aligre-gare-de-lyon/133908165.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
+ , Ad {name = "Appartement", location = "Paris 17ème", price = Just "1 100 €", url = "https://www.seloger.com/annonces/locations/appartement/paris-17eme-75/legendre-levis/134131479.htm?furnished=0&places=%5b%7bcp%3a75%7d%5d&projects=1&qsversion=1.0&rooms=2&types=1&bd=ListToDetail"}
]
SeLogerParser.parse rawSeLogerParser `shouldBe` ads