Suggestion: adding soupsieve.strain
See original GitHub issueHello @facelessuser,
I need to create BeautifulSoup strainers to optimize scrapers for my tool here. But as a convenience for my users, I am going to build them from simple css selectors such as li.item[align=left]
.
I can do so by using your CSSParser
class that processes and return Selector
instances and assess whether the selector is simple enough to befit a strainer. If so, I can build a function that will “apply” this selector to tell the strainer whether it should parse the current node etc.
I will implement this for me in my tool but I was wondering if you’d like me to contribute to this lib instead by adding something like soupsieve.strain
basically. It would return an arg (typically a function) you can give to bs4.SoupStrainer
and should raise a custom error if the selector is found to be too complex for the task. If this is of any interest I can open a PR for this.
Have a good day and thanks for your work,
Issue Analytics
- State:
- Created 2 years ago
- Comments:29 (20 by maintainers)
Top GitHub Comments
@gir-bot remove S: triage @gir-bot add T: feature
It seems that this issue is now stale. Closing for housekeeping. If this is desired in the future, we can reopen and continue discussing.