mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-06-28 21:01:55 +08:00
* fix: error on fetching the code * feat: revert search function * feat: add api integration * ci(release): 1.32.0-beta.1 [skip ci] ## [1.32.0-beta.1](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.31.1...v1.32.0-beta.1) (2024-11-24) ### Features * revert search function ([faf0c01](faf0c0123b)) * fix: improved links extraction for parse_node, resolves #822 * ci(release): 1.32.0-beta.2 [skip ci] ## [1.32.0-beta.2](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.32.0-beta.1...v1.32.0-beta.2) (2024-11-25) ### Bug Fixes * error on fetching the code ([7285ab0](7285ab065b)) * ci(release): 1.32.0-beta.3 [skip ci] ## [1.32.0-beta.3](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.32.0-beta.2...v1.32.0-beta.3) (2024-11-26) ### Bug Fixes * improved links extraction for parse_node, resolves [#822](https://github.com/ScrapeGraphAI/Scrapegraph-ai/issues/822) ([7da7bfe](7da7bfe338)) * chore: migrate from rye to uv * feat: add sdk integration * ci(release): 1.32.0-beta.4 [skip ci] ## [1.32.0-beta.4](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.32.0-beta.3...v1.32.0-beta.4) (2024-12-02) ### Features * add api integration ([8aa9103](8aa9103f02)) * add sdk integration ([209b445](209b4456fd)) ### chore * migrate from rye to uv ([5fe528a](5fe528a7e7)) --------- Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net> Co-authored-by: Michele_Zenoni <michelezenoni1@gmail.com> Co-authored-by: Federico Aguzzi <62149513+f-aguzzi@users.noreply.github.com>
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
"""
|
|
Basic example of scraping pipeline using SmartScraper
|
|
"""
|
|
import os
|
|
import json
|
|
from dotenv import load_dotenv
|
|
from scrapegraphai.graphs import SmartScraperGraph
|
|
from scrapegraphai.utils import prettify_exec_info
|
|
|
|
load_dotenv()
|
|
|
|
# ************************************************
|
|
# Define the configuration for the graph
|
|
# ************************************************
|
|
|
|
|
|
graph_config = {
|
|
"llm": {
|
|
"model": "scrapegraphai/smart-scraper",
|
|
"api_key": os.getenv("SCRAPEGRAPH_API_KEY")
|
|
},
|
|
"verbose": True,
|
|
"headless": False,
|
|
}
|
|
|
|
# ************************************************
|
|
# Create the SmartScraperGraph instance and run it
|
|
# ************************************************
|
|
|
|
smart_scraper_graph = SmartScraperGraph(
|
|
prompt="Extract me all the articles",
|
|
source="https://www.wired.com",
|
|
config=graph_config
|
|
)
|
|
|
|
result = smart_scraper_graph.run()
|
|
print(json.dumps(result, indent=4))
|
|
|
|
# ************************************************
|
|
# Get graph execution info
|
|
# ************************************************
|
|
|
|
graph_exec_info = smart_scraper_graph.get_execution_info()
|
|
print(prettify_exec_info(graph_exec_info))
|