fimad / scalpel

A high level web scraping library for Haskell.
Apache License 2.0
323 stars 43 forks source link

Selector behavior depends on the tag name #96

Closed ocramz closed 1 year ago

ocramz commented 1 year ago

Version : scalpel-core 0.6.2.1

I've just encountered a behavior which looks like a bug ; for certain tag names the behavior of the selector returns an empty string

Define HTML test strings (that only differ in tag name) (the <dl> tag is a "description list" : https://www.w3schools.com/TAGS/tag_dl.asp )

strDL :: String
strDL = "<dl class=\"xxx\">asdf</div>"

strDIV :: String
strDIV = "<div class=\"xxx\">asdf</div>"

and a helper

hasXXX :: TagName -> Selector
hasXXX tag = tag @: [hasClass "xxx"]

Then

-- OverloadedStrings
λ> scrapeStringLike strDL (text (hasXXX "dl"))
Just ""
λ> scrapeStringLike strDIV (text (hasXXX "div"))
Just "asdf"

which is super counterintuitive

ocramz commented 1 year ago

Uggggh sorry my bad. Missed a typo