Skip to content

Commit 9f52602

Browse files
authored
Merge pull request #646 from ScrapeGraphAI/temp
allignement
2 parents a73fec5 + 14c5e6b commit 9f52602

File tree

5 files changed

+58
-27
lines changed

5 files changed

+58
-27
lines changed

CHANGELOG.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
1-
## [1.17.0-beta.11](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.17.0-beta.10...v1.17.0-beta.11) (2024-09-07)
1+
## [1.18.1](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.18.0...v1.18.1) (2024-09-08)
22

33

4-
### Features
4+
### Bug Fixes
55

6-
* add scrape_do_integration ([94e69a0](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/94e69a051591aeec1e7268bf0d5e0338f90e9539))
7-
* fetch_node improved ([167f970](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/167f97040f081867cecff542c3af8aa122499ce8))
6+
* **browser_base_fetch:** correct function signature and async_mode handling ([007ff08](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/007ff084c68d419fac040d9b5cca3980458cfabc))
87

9-
## [1.17.0-beta.10](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.17.0-beta.9...v1.17.0-beta.10) (2024-09-07)
8+
## [1.18.0](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.17.0...v1.18.0) (2024-09-08)
109

1110

12-
### Bug Fixes
1311

14-
* screenshot_scraper ([ef7a589](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/ef7a5891dcb1b4ed8a97947f5563fa78af917ecb))
12+
### Features
13+
14+
* **browser_base_fetch:** add async_mode to support both synchronous and asynchronous execution ([d56253d](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/d56253d183969584cacc0cb164daa0152462f21c))
15+
16+
## [1.17.0](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.16.0...v1.17.0) (2024-09-08)
1517

16-
## [1.17.0-beta.9](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.17.0-beta.8...v1.17.0-beta.9) (2024-09-06)
1718

1819

1920
### Features
2021

21-
* ConcatNode.py added for heavy merge operations ([bd4b26d](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/bd4b26d7d7c1a7953d1bc9d78b436007880028c9))
22+
* **docloaders:** Enhance browser_base_fetch function flexibility ([57fd01f](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/57fd01f9a76ea8ea69ec04b7238ab58ca72ac8f4))
2223

23-
## [1.17.0-beta.8](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.17.0-beta.7...v1.17.0-beta.8) (2024-09-06)
2424

25+
### Docs
2526

26-
### Features
27+
* **sponsor:** 🅱️ Browserbase sponsor 🅱️ ([a540139](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/a5401394cc939d9a5fc58b8a9145141c2f047bab))
2728

2829
* **AbstractGraph:** add adjustable rate limit ([2859fb7](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/2859fb72d699f26b617ed2f949cdcfca1671c5c8))
2930

@@ -98,6 +99,7 @@
9899
* **release:** 1.16.0-beta.3 [skip ci] ([886c987](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/886c987172bb57fb59863e4d7b494797bba16980))
99100
* **release:** 1.16.0-beta.4 [skip ci] ([ba5c7ad](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/ba5c7adcea138d993005377f4cfe438795e1b124))
100101

102+
101103
## [1.16.0](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.15.2...v1.16.0) (2024-09-01)
102104

103105

README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,32 @@ playwright install
3232

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

35-
By the way if you to use not mandatory modules it is necessary to install by yourself with the following command:
35+
<details>
36+
<summary><b>Optional Dependencies</b></summary>
37+
Additional dependecies can be added while installing the library:
38+
39+
- <b>More Language Models</b>: additional language models are installed, such as Fireworks, Groq, Anthropic, Hugging Face, and Nvidia AI Endpoints.
3640

37-
### Installing "Other Language Models"
3841

3942
This group allows you to use additional language models like Fireworks, Groq, Anthropic, Together AI, Hugging Face, and Nvidia AI Endpoints.
4043
```bash
4144
pip install scrapegraphai[other-language-models]
4245

43-
```
44-
### Installing "More Semantic Options"
46+
- <b>Semantic Options</b>: this group includes tools for advanced semantic processing, such as Graphviz.
47+
48+
```bash
49+
pip install scrapegraphai[more-semantic-options]
50+
```
51+
52+
- <b>Browsers Options</b>: this group includes additional browser management tools/services, such as Browserbase.
53+
54+
```bash
55+
pip install scrapegraphai[more-browser-options]
56+
```
57+
58+
</details>
4559

46-
This group includes tools for advanced semantic processing, such as Graphviz.
47-
```bash
48-
pip install scrapegraphai[more-semantic-options]
49-
```
50-
### Installing "More Browser Options"
5160

52-
This group includes additional browser management options, such as BrowserBase.
53-
```bash
54-
pip install scrapegraphai[more-browser-options]
55-
```
5661

5762
### Installing "More Browser Options"
5863

@@ -135,6 +140,9 @@ Check out also the Docusaurus [here](https://scrapegraph-doc.onrender.com/).
135140

136141
## 🏆 Sponsors
137142
<div style="text-align: center;">
143+
<a href="https://2ly.link/1zaXG">
144+
<img src="https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/browserbase_logo.png" alt="Browserbase" style="width: 10%;">
145+
</a>
138146
<a href="https://2ly.link/1zNiz">
139147
<img src="https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/serp_api_logo.png" alt="SerpAPI" style="width: 10%;">
140148
</a>

docs/assets/browserbase_logo.png

3.02 KB
Loading

docs/source/introduction/overview.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ FAQ
8282
Sponsors
8383
========
8484

85+
.. image:: ../../assets/browserbase_logo.png
86+
:width: 10%
87+
:alt: Browserbase
88+
:target: https://www.browserbase.com/
89+
8590
.. image:: ../../assets/serp_api_logo.png
8691
:width: 10%
8792
:alt: Serp API

scrapegraphai/docloaders/browser_base.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
from typing import List
55

6-
def browser_base_fetch(api_key: str, project_id: str, link: List[str]) -> List[str]:
6+
def browser_base_fetch(api_key: str, project_id: str, link: List[str], text_content: bool = True, async_mode: bool = False) -> List[str]:
77
"""
88
BrowserBase Fetch
99
@@ -13,6 +13,8 @@ def browser_base_fetch(api_key: str, project_id: str, link: List[str]) -> List[s
1313
- `api_key`: The API key provided by BrowserBase.
1414
- `project_id`: The ID of the project on BrowserBase where you want to fetch data from.
1515
- `link`: The URL or link that you want to fetch data from.
16+
- `text_content`: A boolean flag to specify whether to return only the text content (True) or the full HTML (False).
17+
- `async_mode`: A boolean flag that determines whether the function runs asynchronously (True) or synchronously (False, default).
1618
1719
It initializes a Browserbase object with the given API key and project ID,
1820
then uses this object to load the specified link.
@@ -35,6 +37,8 @@ def browser_base_fetch(api_key: str, project_id: str, link: List[str]) -> List[s
3537
api_key (str): The API key provided by BrowserBase.
3638
project_id (str): The ID of the project on BrowserBase where you want to fetch data from.
3739
link (str): The URL or link that you want to fetch data from.
40+
text_content (bool): Whether to return only the text content (True) or the full HTML (False). Defaults to True.
41+
async_mode (bool): Whether to run the function asynchronously (True) or synchronously (False). Defaults to False.
3842
3943
Returns:
4044
object: The result of the loading operation.
@@ -49,7 +53,19 @@ def browser_base_fetch(api_key: str, project_id: str, link: List[str]) -> List[s
4953
browserbase = Browserbase(api_key=api_key, project_id=project_id)
5054

5155
result = []
52-
for l in link:
53-
result.append(browserbase.load(l, text_content=True))
56+
async def _async_fetch_link(l):
57+
return await asyncio.to_thread(browserbase.load, l, text_content=text_content)
58+
59+
if async_mode:
60+
async def _async_browser_base_fetch():
61+
for l in link:
62+
result.append(await _async_fetch_link(l))
63+
return result
64+
65+
result = asyncio.run(_async_browser_base_fetch())
66+
else:
67+
for l in link:
68+
result.append(browserbase.load(l, text_content=text_content))
69+
5470

5571
return result

0 commit comments

Comments
 (0)