unclecode / crawl4ai

🔥🕷️ Crawl4AI: Open-source LLM Friendly Web Crawler & Scrapper
Apache License 2.0
1.28k stars 121 forks source link

CSS Selector: gives error #43

Closed merihakca closed 1 day ago

merihakca commented 2 days ago

When I use below statement to select the text only from div summaryPoints, it gives syntax error. What could be the correct syntax ? Notice the single quote inside the double quotes.

css_selector="div id='summaryPoints' "

[ERROR] 🚫 Failed to crawl https://www.bbc.com/news/live/cn087x77g1dt, error: Invalid character '=' position 6 line 1: div id='summaryPoints'

unclecode commented 2 days ago

@merihakca You should pass W3C CSS selector, try it like this:

result = crawler.run( url, css_selector="div#summaryPoints")

You can check this link to know more about this. CSS SElector

merihakca commented 1 day ago

@merihakca You should pass W3C CSS selector, try it like this:

result = crawler.run( url, css_selector="div#summaryPoints")

You can check this link to know more about this. CSS SElector

many thanks