diff options
Diffstat (limited to 'src/Parser/Resume.hs')
-rw-r--r-- | src/Parser/Resume.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Parser/Resume.hs b/src/Parser/Resume.hs index 6cd4415..76faca4 100644 --- a/src/Parser/Resume.hs +++ b/src/Parser/Resume.hs @@ -3,6 +3,7 @@ module Parser.Resume ) where import Data.Maybe (catMaybes) +import Data.Text (Text) import qualified Data.Text as T import Text.HTML.TagSoup @@ -11,7 +12,7 @@ import Model.Resume import Parser.Utils -parseResumes :: T.Text -> [Resume] +parseResumes :: Text -> [Resume] parseResumes page = case sections (~== "<div class=list-lbc>") (parseTags page) of [] -> @@ -20,9 +21,9 @@ parseResumes page = let lbcTags = takeWhile (~/= "<div id=alertesCartouche>") sectionTags in catMaybes . fmap parseResume $ partitions (~== "<a>") lbcTags -parseResume :: [Tag T.Text] -> Maybe Resume +parseResume :: [Tag Text] -> Maybe Resume parseResume item = do name <- getTagTextAfter "<h2 class=title>" item let price = getTagTextAfter "<div class=price>" item url <- getTagAttribute "<a>" (T.pack "href") item - return Resume { name = name, price = price, url = T.unpack url } + return Resume { name = name, price = price, url = url } |