diff options
Diffstat (limited to 'src/Parser/Resume.hs')
-rw-r--r-- | src/Parser/Resume.hs | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/src/Parser/Resume.hs b/src/Parser/Resume.hs deleted file mode 100644 index 8940be7..0000000 --- a/src/Parser/Resume.hs +++ /dev/null @@ -1,31 +0,0 @@ -module Parser.Resume - ( parse - ) where - -import Data.Maybe (catMaybes, isJust) -import Data.List (find) -import Data.Text (Text) -import qualified Data.Text as T - -import Text.HTML.TagSoup - -import Model.Resume (Resume(Resume)) - -import Parser.Utils - -parse :: Text -> [Resume] -parse page = - case dropWhile (not . hasClass (T.pack "section") (T.pack "tabsContent")) (parseTags page) of - [] -> - [] - sectionTags -> - let lbcTags = takeWhile (not . hasClass (T.pack "div") (T.pack "information-immo")) sectionTags - in catMaybes . fmap parseResume $ partitions (~== "<a>") lbcTags - -parseResume :: [Tag Text] -> Maybe Resume -parseResume item = do - name <- getTagTextAfter "<h2 class=item_title>" item - let price = getTagTextAfter "<h3 class=item_price>" item - url <- getTagAttribute "<a>" (T.pack "href") item - let isPro = isJust . find (~== "<span class=ispro>") $ item - return (Resume name price (T.concat [T.pack "https:", url]) isPro) |