scrappy-core-0.1.0.1: html pattern matching library and high-level interface concurrent requests lib for webscraping
Safe HaskellNone
LanguageHaskell2010

Scrappy.Elem.ElemHeadParse

Synopsis

Documentation

href :: forall s (m :: Type -> Type) u. Stream s m Char => Bool -> LastUrl -> ParsecT s u m Link Source #

needs to use many for multiple links

href' :: forall s (m :: Type -> Type) u. Stream s m Char => Maybe CurrentUrl -> ParsecT s u m Link Source #

parseAttrSafe :: forall s (m :: Type -> Type) u. Stream s m Char => String -> ParsecT s u m String Source #

Safe because it forces parse of the entire ElemHead then pulls if there | Designed for use in findSomeHtml

hrefParser :: forall s (m :: Type -> Type) u. Stream s m Char => ParsecT s u m String Source #

Done like this so that it reliably is true link and not false positive

parseOpeningTagF :: forall s (m :: Type -> Type) u. Stream s m Char => String -> (String -> Bool) -> ParsecT s u m ElemHead Source #

parseOpeningTagWhere :: forall s (m :: Type -> Type) u. Stream s m Char => Maybe [Elem] -> String -> (String -> Bool) -> ParsecT s u m ElemHead Source #

TODO(galen): make this actually generic, not just for one attr

hrefParser' :: forall s (m :: Type -> Type) u. Stream s m Char => (String -> Bool) -> ParsecT s u m String Source #

Allows parsing with high level predicate

attrValue :: forall s (m :: Type -> Type) u. Stream s m Char => ParsecT s u m [Char] Source #

In future should add replace of apostrophe and similar issues to corresponding html representations

attrValuesExist :: [(String, String)] -> [(String, Maybe String)] -> Bool Source #

Both attrValue functions mimic map functionality

attrName :: forall s (m :: Type -> Type) u. Stream s m Char => ParsecT s u m String Source #

attrParser :: forall s (m :: Type -> Type) u. Stream s m Char => ParsecT s u m (String, String) Source #

Need lower|UPPER case insensitivity

for generalization sake

attrsParser :: forall s (m :: Type -> Type) u. Stream s m Char => [(String, Maybe String)] -> ParsecT s u m (Either AttrsError (Map String String)) Source #

attrsParserDesc :: forall s (m :: Type -> Type) u. Stream s m Char => [(String, String)] -> ParsecT s u m (Map String String) Source #

parseOpeningTagDesc :: forall s (m :: Type -> Type) u. Stream s m Char => Maybe [Elem] -> [(String, String)] -> ParsecT s u m (Elem, Attrs) Source #

digitEq :: String -> String -> Bool Source #

Allows for certain degrees of freedom such as 1 spot off eg 123 vs 1230 (or even (109|22)) | as well as any numerical digit must also be a numerical digit from 0 to 9

parseOpeningTag :: forall s (m :: Type -> Type) u. Stream s m Char => Maybe [Elem] -> [(String, Maybe String)] -> ParsecT s u m (Elem, Attrs) Source #

NOTES if href="#" on form -> just means scroll to top

May rename parseOpeningTag to elemHeadParser | -> Case of input tag: ...." DONE ie no innerhtml or end tag | then this would be more efficient or even maybe we should add an option via | a datatype: InnerTextOpts a = DoesntExist --efficient parser | AnyText | ParserText a

mkElemtagParser :: forall s (m :: Type -> Type) u. Stream s m Char => Maybe [Elem] -> ParsecT s u m String Source #

For elemsOpts, will either be | Parser: (anyChar) | Parser: (buildElemsOpts elems)

buildElemsOpts :: forall s (m :: Type -> Type) u. Stream s m Char => [Elem] -> ParsecT s u m String Source #

FUTURE USE CASES: buildElemsOpts :: [ParsecT s u m a] -> ParsecT s u m a -- using |