Comments (3)
How would matchAll
work if you passed different selectors to html
and attr
?
It seems like it may not make sense with different selectors and that you would need something with a type like :: Selectable s => (s -> Scraper str a) -> (s -> Scraper str b) -> s -> Scraper s [(a, b)]
so that you can ensure that you are selecting on the same elements. Of course this doesn't generalize as nicely :/
Another, though less intuitive option, is to abuse chroots
and Any
:
chroots "a" $ do
x <- attr "title" Any
guard (somePredicate x)
html Any
from scalpel.
How would
matchAll
work if you passed different selectors tohtml
andattr
?
Presumably, it would return the empty list, since no single element has both selectors.
I hadn't thought of the chroots
trick; I think it should be added to the chroots
documentation, and that may be enough.
from scalpel.
Closing out for now, if you feel like the current documentation isn't extensive or visible enough please reopen.
from scalpel.
Related Issues (20)
- 0.6.2.1 does not compile HOT 1
- build of 0.6.2.1 fails with GHC 9.8.1 (base 4.19.0.0) HOT 1
- Compilation on GHC newer than 9.4.x fails due to missing MonadFix HOT 2
- Class for things that can be parsed by Scalpel HOT 5
- Document scalpel's parsing algorithm
- Ignore this, was a mistake, sorry HOT 1
- Remove String and use StringLike HOT 1
- Allow direct manipulation of TagSpec object HOT 3
- \r\n HOT 4
- scalpel-core and scalpel have been removed from stackage HOT 2
- howto extract all attribute pairs of a tag HOT 1
- <|> is defined in hidden module HOT 2
- ScraperT instances for MonadThrow and MonadCatch
- Build failure with mtl-2.3 HOT 5
- `MonadFail`-related build failures in `scalpel-core <= 0.6.0` HOT 1
- Expose internals of AttributePredicate HOT 1
- Highly unintuitive behavior of `inSerial . stepNext . inSerial . stepNext` HOT 2
- Selector behavior depends on the tag name HOT 1
- Suggestion : AttributePredicate combinators HOT 1
- Replace Maybe with a descriptive error type (Either) HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalpel.