feat(docs): enhance table data access example with a real url

This commit is contained in:
ntohidi
2025-08-06 15:19:37 +08:00
parent 45d8327d23
commit a5bcac4c9d

View File

@@ -221,9 +221,13 @@ Tables that score above the threshold (default: 7) are extracted and stored in r
### Accessing Table data: ### Accessing Table data:
```python ```python
import asyncio
from crawl4ai import AsyncWebCrawler, CrawlerRunConfig
async def main():
async with AsyncWebCrawler() as crawler: async with AsyncWebCrawler() as crawler:
result = await crawler.arun( result = await crawler.arun(
url="https://example.com/", url="https://www.w3schools.com/html/html_tables.asp",
config=CrawlerRunConfig( config=CrawlerRunConfig(
table_score_threshold=7 # Minimum score for table detection table_score_threshold=7 # Minimum score for table detection
) )
@@ -241,6 +245,10 @@ async with AsyncWebCrawler() as crawler:
# Print first few rows as example # Print first few rows as example
for j, row in enumerate(table['rows'][:3]): for j, row in enumerate(table['rows'][:3]):
print(f" Row {j+1}: {row}") print(f" Row {j+1}: {row}")
if __name__ == "__main__":
asyncio.run(main())
``` ```
### Configuring Table Extraction: ### Configuring Table Extraction: