Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: Combine selectors #40

Closed
oleid opened this issue Mar 29, 2020 · 3 comments
Closed

Q: Combine selectors #40

oleid opened this issue Mar 29, 2020 · 3 comments

Comments

@oleid
Copy link

oleid commented Mar 29, 2020

Just discovered this care today, really nice!
One question though: Is it possible to combine selectors?

I wrote some code today to extract content from a wordpress page. First selected the <article> tag, then all <p>. Which basically does the trick. Yet, titles and possibly images are missing.

So I was wondering, if it was somehow possible to create a selector, which selects p | h1 | h2 and so on?

Or if that isn't possible, what would be the recommended approach?

@causal-agent
Copy link
Owner

The selector p, h1, h2 matches any of the three elements.

@adamrmelnyk
Copy link

adamrmelnyk commented Jun 10, 2020

@causal-agent Do you mind if I open a PR to ad an example of this in the README? This question and your answer saved me a lot of time!

@causal-agent
Copy link
Owner

I don't think scraper's readme is the place to document CSS selector syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants