+7
-14
lines changedFilter options
+7
-14
lines changed Original file line number Diff line number Diff line change
@@ -49,7 +49,6 @@ module Advent.API (
49
49
, RawText
50
50
-- * Internal
51
51
, processHTML
52
-
, processDivs
53
52
) where
54
53
55
54
import Advent.Types
@@ -94,10 +93,14 @@ instance Accept RawText where
94
93
instance MimeUnrender RawText Text where
95
94
mimeUnrender _ = first show . T.decodeUtf8' . BSL.toStrict
96
95
97
-
-- | Interpret repsonse as a list of HTML 'Text' in the given type of tag
96
+
-- | Interpret repsonse as a list of HTML 'Text' found in the given type of
97
+
-- tag
98
98
data HTMLTags (tag :: Symbol)
99
99
100
+
-- | Interpret a response as a list of HTML 'Text' found in @<article>@ tags.
100
101
type Articles = HTMLTags "article"
102
+
103
+
-- | Interpret a response as a list of HTML 'Text' found in @<div>@ tags.
101
104
type Divs = HTMLTags "div"
102
105
103
106
-- | Class for interpreting a list of 'Text' in tags to some desired
@@ -286,15 +289,3 @@ processHTML tag = mapMaybe getTag
286
289
x:xs -> x <> "</title>" <> T.intercalate "</span>" xs
287
290
[] -> "" -- this shouldn't ever happen because splitOn is always non-empty
288
291
289
-
processDivs :: String -> Text -> [Text]
290
-
processDivs cls = mapMaybe isDiv
291
-
. H.universeTree
292
-
. H.parseTree
293
-
where
294
-
isDiv :: TagTree Text -> Maybe Text
295
-
isDiv (TagBranch n attrs cld)
296
-
| n == "div"
297
-
, ("class", T.pack cls) `elem` attrs
298
-
= Just $ H.renderTree cld
299
-
isDiv _ = Nothing
300
-
Original file line number Diff line number Diff line change
@@ -173,6 +173,7 @@ data DailyLeaderboardMember = DLBM
173
173
}
174
174
deriving (Show, Eq, Ord, Typeable, Generic)
175
175
176
+
-- | Daily leaderboard, containing Star 1 and Star 2 completions
176
177
data DailyLeaderboard = DLB {
177
178
dlbStar1 :: Map Rank DailyLeaderboardMember
178
179
, dlbStar2 :: Map Rank DailyLeaderboardMember
@@ -190,6 +191,7 @@ data GlobalLeaderboardMember = GLBM
190
191
}
191
192
deriving (Show, Eq, Ord, Typeable, Generic)
192
193
194
+
-- | Global leaderboard for the entire event
193
195
newtype GlobalLeaderboard = GLB {
194
196
glbMap :: Map Rank (Integer, NonEmpty GlobalLeaderboardMember)
195
197
}
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4