Skip to content

Commit c377ae0

Browse files
authored
docs: updated readme
1 parent 4182e23 commit c377ae0

File tree

1 file changed

+40
-115
lines changed

1 file changed

+40
-115
lines changed

README.md

Lines changed: 40 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ScrapeGraphAI is a *web scraping* python library that uses LLM and direct graph
1717
Just say which information you want to extract and the library will do it for you!
1818

1919
<p align="center">
20-
<img src="https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/scrapegraphai_logo.png" alt="Scrapegraph-ai Logo" style="width: 50%;">
20+
<img src="https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/sgai-hero.png" alt="ScrapeGraphAI Hero" style="width: 100%;">
2121
</p>
2222

2323
## 🚀 Quick install
@@ -26,159 +26,84 @@ The reference page for Scrapegraph-ai is available on the official page of PyPI:
2626

2727
```bash
2828
pip install scrapegraphai
29+
30+
playwright install
2931
```
3032

3133
**Note**: it is recommended to install the library in a virtual environment to avoid conflicts with other libraries 🐱
3234

33-
## 🔍 Demo
34-
Official streamlit demo:
35-
36-
[![My Skills](https://skillicons.dev/icons?i=react)](https://scrapegraph-ai-web-dashboard.streamlit.app)
37-
38-
Try it directly on the web using Google Colab:
39-
40-
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1sEZBonBMGP44CtO6GQTwAlL0BGJXjtfd?usp=sharing)
41-
42-
## 📖 Documentation
43-
44-
The documentation for ScrapeGraphAI can be found [here](https://scrapegraph-ai.readthedocs.io/en/latest/).
45-
46-
Check out also the Docusaurus [here](https://scrapegraph-doc.onrender.com/).
47-
4835
## 💻 Usage
49-
There are multiple standard scraping pipelines that can be used to extract information from a website (or local file):
50-
- `SmartScraperGraph`: single-page scraper that only needs a user prompt and an input source;
51-
- `SearchGraph`: multi-page scraper that extracts information from the top n search results of a search engine;
52-
- `SpeechGraph`: single-page scraper that extracts information from a website and generates an audio file.
53-
- `ScriptCreatorGraph`: single-page scraper that extracts information from a website and generates a Python script.
36+
There are multiple standard scraping pipelines that can be used to extract information from a website (or local file).
5437

55-
- `SmartScraperMultiGraph`: multi-page scraper that extracts information from multiple pages given a single prompt and a list of sources;
56-
- `ScriptCreatorMultiGraph`: multi-page scraper that generates a Python script for extracting information from multiple pages given a single prompt and a list of sources.
57-
58-
It is possible to use different LLM through APIs, such as **OpenAI**, **Groq**, **Azure** and **Gemini**, or local models using **Ollama**.
38+
The most common one is the `SmartScraperGraph`, which extracts information from a single page given a user prompt and a source URL.
5939

60-
### Case 1: SmartScraper using Local Models
61-
62-
Remember to have [Ollama](https://ollama.com/) installed and download the models using the **ollama pull** command.
6340

6441
```python
42+
import json
6543
from scrapegraphai.graphs import SmartScraperGraph
6644

45+
# Define the configuration for the scraping pipeline
6746
graph_config = {
6847
"llm": {
69-
"model": "ollama/mistral",
70-
"temperature": 0,
71-
"format": "json", # Ollama needs the format to be specified explicitly
72-
"base_url": "http://localhost:11434", # set Ollama URL
73-
},
74-
"embeddings": {
75-
"model": "ollama/nomic-embed-text",
76-
"base_url": "http://localhost:11434", # set Ollama URL
48+
"api_key": "YOUR_OPENAI_APIKEY",
49+
"model": "gpt-4o-mini",
7750
},
7851
"verbose": True,
52+
"headless": False,
7953
}
8054

55+
# Create the SmartScraperGraph instance
8156
smart_scraper_graph = SmartScraperGraph(
82-
prompt="List me all the projects with their descriptions",
83-
# also accepts a string with the already downloaded HTML code
84-
source="https://perinim.github.io/projects",
57+
prompt="Find some information about what does the company do, the name and a contact email.",
58+
source="https://scrapegraphai.com/",
8559
config=graph_config
8660
)
8761

62+
# Run the pipeline
8863
result = smart_scraper_graph.run()
89-
print(result)
90-
64+
print(json.dumps(result, indent=4))
9165
```
9266

93-
The output will be a list of projects with their descriptions like the following:
67+
The output will be a dictionary like the following:
9468

9569
```python
96-
{'projects': [{'title': 'Rotary Pendulum RL', 'description': 'Open Source project aimed at controlling a real life rotary pendulum using RL algorithms'}, {'title': 'DQN Implementation from scratch', 'description': 'Developed a Deep Q-Network algorithm to train a simple and double pendulum'}, ...]}
97-
```
98-
99-
### Case 2: SearchGraph using Mixed Models
100-
101-
We use **Groq** for the LLM and **Ollama** for the embeddings.
102-
103-
```python
104-
from scrapegraphai.graphs import SearchGraph
105-
106-
# Define the configuration for the graph
107-
graph_config = {
108-
"llm": {
109-
"model": "groq/gemma-7b-it",
110-
"api_key": "GROQ_API_KEY",
111-
"temperature": 0
112-
},
113-
"embeddings": {
114-
"model": "ollama/nomic-embed-text",
115-
"base_url": "http://localhost:11434", # set ollama URL arbitrarily
116-
},
117-
"max_results": 5,
70+
{
71+
"company": "ScrapeGraphAI",
72+
"name": "ScrapeGraphAI Extracting content from websites and local documents using LLM",
73+
"contact_email": "[email protected]"
11874
}
75+
```
11976

120-
# Create the SearchGraph instance
121-
search_graph = SearchGraph(
122-
prompt="List me all the traditional recipes from Chioggia",
123-
config=graph_config
124-
)
77+
There are other pipelines that can be used to extract information from multiple pages, generate Python scripts, or even generate audio files.
12578

126-
# Run the graph
127-
result = search_graph.run()
128-
print(result)
129-
```
79+
| Pipeline Name | Description |
80+
|-------------------------|------------------------------------------------------------------------------------------------------------------|
81+
| SmartScraperGraph | Single-page scraper that only needs a user prompt and an input source. |
82+
| SearchGraph | Multi-page scraper that extracts information from the top n search results of a search engine. |
83+
| SpeechGraph | Single-page scraper that extracts information from a website and generates an audio file. |
84+
| ScriptCreatorGraph | Single-page scraper that extracts information from a website and generates a Python script. |
85+
| SmartScraperMultiGraph | Multi-page scraper that extracts information from multiple pages given a single prompt and a list of sources. |
86+
| ScriptCreatorMultiGraph | Multi-page scraper that generates a Python script for extracting information from multiple pages and sources. |
13087

131-
The output will be a list of recipes like the following:
88+
It is possible to use different LLM through APIs, such as **OpenAI**, **Groq**, **Azure** and **Gemini**, or local models using **Ollama**.
13289

133-
```python
134-
{'recipes': [{'name': 'Sarde in Saòre'}, {'name': 'Bigoli in salsa'}, {'name': 'Seppie in umido'}, {'name': 'Moleche frite'}, {'name': 'Risotto alla pescatora'}, {'name': 'Broeto'}, {'name': 'Bibarasse in Cassopipa'}, {'name': 'Risi e bisi'}, {'name': 'Smegiassa Ciosota'}]}
135-
```
136-
### Case 3: SpeechGraph using OpenAI
90+
Remember to have [Ollama](https://ollama.com/) installed and download the models using the **ollama pull** command, if you want to use local models.
13791

138-
You just need to pass the OpenAI API key and the model name.
92+
## 🔍 Demo
93+
Official streamlit demo:
13994

140-
```python
141-
from scrapegraphai.graphs import SpeechGraph
95+
[![My Skills](https://skillicons.dev/icons?i=react)](https://scrapegraph-ai-web-dashboard.streamlit.app)
14296

143-
graph_config = {
144-
"llm": {
145-
"api_key": "OPENAI_API_KEY",
146-
"model": "gpt-3.5-turbo",
147-
},
148-
"tts_model": {
149-
"api_key": "OPENAI_API_KEY",
150-
"model": "tts-1",
151-
"voice": "alloy"
152-
},
153-
"output_path": "audio_summary.mp3",
154-
}
97+
Try it directly on the web using Google Colab:
15598

156-
# ************************************************
157-
# Create the SpeechGraph instance and run it
158-
# ************************************************
99+
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1sEZBonBMGP44CtO6GQTwAlL0BGJXjtfd?usp=sharing)
159100

160-
speech_graph = SpeechGraph(
161-
prompt="Make a detailed audio summary of the projects.",
162-
source="https://perinim.github.io/projects/",
163-
config=graph_config,
164-
)
101+
## 📖 Documentation
165102

166-
result = speech_graph.run()
167-
print(result)
103+
The documentation for ScrapeGraphAI can be found [here](https://scrapegraph-ai.readthedocs.io/en/latest/).
168104

169-
```
105+
Check out also the Docusaurus [here](https://scrapegraph-doc.onrender.com/).
170106

171-
The output will be an audio file with the summary of the projects on the page.
172-
173-
## Sponsors
174-
<div style="text-align: center;">
175-
<a href="https://serpapi.com?utm_source=scrapegraphai">
176-
<img src="https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/serp_api_logo.png" alt="SerpAPI" style="width: 10%;">
177-
</a>
178-
<a href="https://dashboard.statproxies.com/?refferal=scrapegraph">
179-
<img src="https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/transparent_stat.png" alt="Stats" style="width: 15%;">
180-
</a>
181-
</div>
182107

183108
## 🤝 Contributing
184109

0 commit comments

Comments
 (0)