|
@@ -9,7 +9,7 @@ import Data.List.Types (NonEmptyList)
|
|
|
import Data.Maybe (Maybe(..))
|
|
import Data.Maybe (Maybe(..))
|
|
|
import Data.Show.Generic (genericShow)
|
|
import Data.Show.Generic (genericShow)
|
|
|
import Data.Traversable (class Traversable, sequence, traverse, traverseDefault)
|
|
import Data.Traversable (class Traversable, sequence, traverse, traverseDefault)
|
|
|
-import LinkedIn.QueryRunner (QueryError(..), QueryRunner, chooseOne, chooseOne3, ignoreNotFound, queryAll, queryOne, queryText, subQueryMany, subQueryOne)
|
|
|
|
|
|
|
+import LinkedIn.QueryRunner (QueryError(..), QueryRunner, chooseOne, chooseOne3, ignoreNotFound, queryAll, queryOne, queryText)
|
|
|
import Web.DOM (Node)
|
|
import Web.DOM (Node)
|
|
|
import Web.DOM.Node as N
|
|
import Web.DOM.Node as N
|
|
|
|
|
|
|
@@ -206,11 +206,9 @@ queryTopCardInsightContentButton n =
|
|
|
queryTopCardInsightContentSecondary :: QueryRunner (TopCardInsightContent Node)
|
|
queryTopCardInsightContentSecondary :: QueryRunner (TopCardInsightContent Node)
|
|
|
queryTopCardInsightContentSecondary n = do
|
|
queryTopCardInsightContentSecondary n = do
|
|
|
primary <- queryOne ":scope > span:first-child span[aria-hidden=true]" n
|
|
primary <- queryOne ":scope > span:first-child span[aria-hidden=true]" n
|
|
|
- s <- subQueryMany
|
|
|
|
|
- queryTopCardSecondaryInsight
|
|
|
|
|
- ":scope > span.job-details-jobs-unified-top-card__job-insight-view-model-secondary"
|
|
|
|
|
- n
|
|
|
|
|
- pure $ TopCardInsightContentSecondary {primary, secondary: s}
|
|
|
|
|
|
|
+ secondary <- traverse queryTopCardSecondaryInsight
|
|
|
|
|
+ =<< queryAll ":scope > span.job-details-jobs-unified-top-card__job-insight-view-model-secondary" n
|
|
|
|
|
+ pure $ TopCardInsightContentSecondary {primary, secondary}
|
|
|
|
|
|
|
|
queryTopCardInsightContent :: QueryRunner (TopCardInsightContent Node)
|
|
queryTopCardInsightContent :: QueryRunner (TopCardInsightContent Node)
|
|
|
queryTopCardInsightContent n =
|
|
queryTopCardInsightContent n =
|
|
@@ -219,9 +217,9 @@ queryTopCardInsightContent n =
|
|
|
queryTopCardInsight :: QueryRunner (TopCardInsight Node)
|
|
queryTopCardInsight :: QueryRunner (TopCardInsight Node)
|
|
|
queryTopCardInsight n = do
|
|
queryTopCardInsight n = do
|
|
|
icon <- chooseOne (queryOne ":scope li-icon") (queryOne ":scope svg") n
|
|
icon <- chooseOne (queryOne ":scope li-icon") (queryOne ":scope svg") n
|
|
|
- c <- queryTopCardInsightContent =<< getContentNode n
|
|
|
|
|
|
|
+ content <- queryTopCardInsightContent =<< getContentNode n
|
|
|
|
|
|
|
|
- pure $ TopCardInsight {icon, content: c}
|
|
|
|
|
|
|
+ pure $ TopCardInsight {icon, content}
|
|
|
|
|
|
|
|
where
|
|
where
|
|
|
getContentNode = chooseOne (queryOne ":scope > span") (queryOne ":scope > button")
|
|
getContentNode = chooseOne (queryOne ":scope > span") (queryOne ":scope > button")
|
|
@@ -236,20 +234,19 @@ queryTopCardPrimaryDescription n = do
|
|
|
|
|
|
|
|
queryJobsUnifiedTopCardElement :: QueryRunner (JobsUnifiedTopCardElement Node)
|
|
queryJobsUnifiedTopCardElement :: QueryRunner (JobsUnifiedTopCardElement Node)
|
|
|
queryJobsUnifiedTopCardElement n = do
|
|
queryJobsUnifiedTopCardElement n = do
|
|
|
- h1 <- queryOne "h1.job-details-jobs-unified-top-card__job-title" n
|
|
|
|
|
- p <- subQueryOne
|
|
|
|
|
- queryTopCardPrimaryDescription
|
|
|
|
|
- "div.job-details-jobs-unified-top-card__primary-description-container > div"
|
|
|
|
|
- n
|
|
|
|
|
- i <- ignoreNotFound $
|
|
|
|
|
- subQueryMany queryTopCardInsight "li.job-details-jobs-unified-top-card__job-insight" n
|
|
|
|
|
- a <- ignoreNotFound $ subQueryMany queryTopCardAction ".mt5 button" n
|
|
|
|
|
|
|
+ header <- queryOne "h1.job-details-jobs-unified-top-card__job-title" n
|
|
|
|
|
+ primaryDescription <- queryTopCardPrimaryDescription
|
|
|
|
|
+ =<< queryOne "div.job-details-jobs-unified-top-card__primary-description-container > div" n
|
|
|
|
|
+ insights <- ignoreNotFound
|
|
|
|
|
+ <<< traverse queryTopCardInsight
|
|
|
|
|
+ =<< queryAll "li.job-details-jobs-unified-top-card__job-insight" n
|
|
|
|
|
+ actions <- ignoreNotFound <<< traverse queryTopCardAction =<< queryAll ".mt5 button" n
|
|
|
|
|
|
|
|
pure $ JobsUnifiedTopCardElement {
|
|
pure $ JobsUnifiedTopCardElement {
|
|
|
- header: h1,
|
|
|
|
|
- primaryDescription: p,
|
|
|
|
|
- insights: i,
|
|
|
|
|
- actions: a
|
|
|
|
|
|
|
+ header,
|
|
|
|
|
+ primaryDescription,
|
|
|
|
|
+ insights,
|
|
|
|
|
+ actions
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
toHeader ∷ forall a. JobsUnifiedTopCardElement a → a
|
|
toHeader ∷ forall a. JobsUnifiedTopCardElement a → a
|