Skip to content

Commit 77daf48

Browse files
authored
Merge pull request #842 from ScrapeGraphAI/temp
allignment
2 parents 09995cd + c1a2177 commit 77daf48

File tree

6 files changed

+122
-79
lines changed

6 files changed

+122
-79
lines changed

CHANGELOG.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
## [1.33.0-beta.2](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.33.0-beta.1...v1.33.0-beta.2) (2024-12-06)
1+
## [1.33.2](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.33.1...v1.33.2) (2024-12-06)
22

33

4-
### Features
4+
### Bug Fixes
5+
6+
* client ([e16e94b](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/e16e94bf694d516071818adec5ea2f3a1404ec72))
7+
8+
## [1.33.1](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.33.0...v1.33.1) (2024-12-06)
9+
10+
11+
### Bug Fixes
12+
13+
* did a quick fix ([a6f43d5](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/a6f43d53cb760e74e5b437cb721b09a4e569c5a2))
514

6-
* added scrolling method to chromium docloader ([1c8b910](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/1c8b910562112947a357277bca9dc81619b72e61))
15+
## [1.33.0](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.32.0...v1.33.0) (2024-12-05)
716

8-
## [1.33.0-beta.1](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.32.0...v1.33.0-beta.1) (2024-12-05)
917

1018

1119
### Features

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@
1616
<a href="https://trendshift.io/repositories/9761" target="_blank"><img src="https://trendshift.io/api/badge/repositories/9761" alt="VinciGit00%2FScrapegraph-ai | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
1717
<p align="center">
1818

19-
### Check our Website
20-
[ScrapeGraphAI Official website](https://scrapegraphai.com/)
21-
22-
ScrapeGraphAI is a *web scraping* python library that uses LLM and direct graph logic to create scraping pipelines for websites and local documents (XML, HTML, JSON, Markdown, etc.).
19+
[ScrapeGraphAI](https://scrapegraphai.com) is a *web scraping* python library that uses LLM and direct graph logic to create scraping pipelines for websites and local documents (XML, HTML, JSON, Markdown, etc.).
2320

2421
Just say which information you want to extract and the library will do it for you!
2522

2623
<p align="center">
2724
<img src="https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/sgai-hero.png" alt="ScrapeGraphAI Hero" style="width: 100%;">
2825
</p>
2926

27+
## News 📰
28+
29+
- ScrapegraphAI has now his APIs! Check it out [here](https://scrapegraphai.com)!
30+
3031
## 🚀 Quick install
3132

3233
The reference page for Scrapegraph-ai is available on the official page of PyPI: [pypi](https://pypi.org/project/scrapegraphai/).

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ name = "scrapegraphai"
33

44

55

6-
version = "1.33.0b2"
7-
6+
version = "1.33.2"
87

98

109

@@ -45,7 +44,7 @@ dependencies = [
4544
"googlesearch-python>=1.2.5",
4645
"simpleeval>=1.0.0",
4746
"async_timeout>=4.0.3",
48-
"scrapegraph-py>=0.0.4"
47+
"scrapegraph-py>=1.7.0"
4948
]
5049

5150
license = "MIT"

scrapegraphai/docloaders/chromium.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,14 @@ async def ascrape_playwright(self, url: str) -> str:
265265
if attempt == self.RETRY_LIMIT:
266266
results = f"Error: Network error after {self.RETRY_LIMIT} attempts - {e}"
267267
finally:
268-
await browser.close()
268+
if "browser" in locals():
269+
await browser.close()
270+
269271

270272
return results
271273

272274

275+
273276
async def ascrape_with_js_support(self, url: str) -> str:
274277
"""
275278
Asynchronously scrape the content of a given URL by rendering JavaScript using Playwright.

scrapegraphai/graphs/smart_scraper_graph.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from typing import Optional
66
from pydantic import BaseModel
7+
from scrapegraph_py import Client
8+
from scrapegraph_py.logger import sgai_logger
79
from .base_graph import BaseGraph
810
from .abstract_graph import AbstractGraph
911
from ..nodes import (
@@ -14,7 +16,6 @@
1416
ConditionalNode,
1517
)
1618
from ..prompts import REGEN_ADDITIONAL_INFO
17-
from scrapegraph_py import SyncClient
1819

1920
class SmartScraperGraph(AbstractGraph):
2021
"""
@@ -65,12 +66,23 @@ def _create_graph(self) -> BaseGraph:
6566
"""
6667
if self.llm_model == "scrapegraphai/smart-scraper":
6768

68-
sgai_client = SyncClient(api_key=self.config.get("api_key"))
69+
sgai_logger.set_logging(level="INFO")
6970

71+
# Initialize the client with explicit API key
72+
sgai_client = Client(api_key=self.config.get("api_key"))
73+
74+
# SmartScraper request
7075
response = sgai_client.smartscraper(
7176
website_url=self.source,
72-
user_prompt=self.prompt
77+
user_prompt=self.prompt,
7378
)
79+
80+
# Print the response
81+
print(f"Request ID: {response['request_id']}")
82+
print(f"Result: {response['result']}")
83+
84+
sgai_client.close()
85+
7486
return response
7587

7688
fetch_node = FetchNode(

0 commit comments

Comments
 (0)