rushter / selectolax

Python binding to Modest and Lexbor engines (fast HTML5 parser with CSS selectors).
MIT License
1.11k stars 68 forks source link

Does `selectolax` support contains query ? #86

Closed baseplate-admin closed 1 year ago

baseplate-admin commented 1 year ago

Hi thanks for creating selectolax. I was considering if selectolax supports contains query.

Here's an example :

from selectolax.parser import HTMLParser

html = """
<div>
  <p>Some text here</p>
  <p>Some more text here</p>
  <p>Yet more text</p>
</div>
"""

parser = HTMLParser(html)
nodes = parser.css('p:contains("text")')

for node in nodes:
    print(node.text())

Which returns :

zsh: segmentation fault (core dumped) python test.py

baseplate-admin commented 1 year ago

Closing per https://github.com/lexbor/lexbor/issues/181#issuecomment-1514261024

AmericanY commented 1 year ago

@baseplate-admin did you reached a solution for that case?

baseplate-admin commented 1 year ago

@baseplate-admin did you reached a solution for that case?

Yes i did. Check : https://github.com/baseplate-admin/CoreProject/blob/927254e99af46eca860dabacad208e72a1d8861d/backend/shinobi/parser/anime.py#L60