Skip to content

Python scraper based on AI

Update README.md

Marco Vinciguerra15e7e0f8b559
diff --git a/README.md b/README.md
index e6ec1e85..46b087ca 100644
--- a/README.md
+++ b/README.md
@@ -50,31 +50,26 @@ You can use the `SmartScraper` class to extract information from a website using
The `SmartScraper` class is a direct graph implementation that uses the most common nodes present in a web scraping pipeline. For more information, please see the [documentation](https://scrapegraph-ai.readthedocs.io/en/latest/).
```python
-import os
-from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperGraph
-
-load_dotenv()
-openai_key = os.getenv("OPENAI_APIKEY")
+OPENAI_API_KEY = "YOUR_API_KEY"
# Define the configuration for the graph
graph_config = {
"llm": {
- "api_key": openai_key,
+ "api_key": OPENAI_API_KEY,
"model": "gpt-3.5-turbo",
},
}
# Create the SmartScraperGraph instance
smart_scraper_graph = SmartScraperGraph(
- prompt="List me all the titles and project descriptions"
- file_source="https://perinim.github.io/projects/", #Also accepts a string with the already downloaded HTML code
+ prompt="List me all the news with their description.",
+ file_source="https://perinim.github.io/projects/", # also accepts a string with the already downloaded HTML code as string format
config=graph_config
)
result = smart_scraper_graph.run()
print(result)
-
```
The output will be a dictionary with the extracted information, for example: