Skip to content

Commit 7be0178

Browse files
committed
Align SDK with current API documentation
Add the latest documented endpoints, remove obsolete YouTube APIs, and update supported Python tooling and documentation so the SDK matches the current public API surface.
1 parent 50e57cc commit 7be0178

8 files changed

Lines changed: 410 additions & 153 deletions

File tree

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
python-version: ['3.10', '3.11']
20+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
2121
steps:
2222
- uses: actions/checkout@v3
2323
- name: Set up Python

CHANGELOG.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
# Changelog
22

3-
## [2.1.0](https://github.com/ScrapingBee/scrapingbee-python/compare/v2.0.2...v2.1.0) (2024-12-18)
3+
## [2.1.0](https://github.com/ScrapingBee/scrapingbee-python/compare/v2.0.2...v2.1.0) (2026-07-20)
44

55
### Features
66

77
- Added `html_api()` method for HTML API with unified GET/POST support
88
- Added `google_search()` method for Google Search API
9+
- Added `fast_search()` method for Fast Search API
910
- Added `amazon_search()` method for Amazon Search API
1011
- Added `amazon_product()` method for Amazon Product API
12+
- Added `amazon_pricing()` method for Amazon Pricing API
1113
- Added `walmart_search()` method for Walmart Search API
1214
- Added `walmart_product()` method for Walmart Product API
1315
- Added `youtube_search()` method for YouTube Search API
1416
- Added `youtube_metadata()` method for YouTube Metadata API
15-
- Added `youtube_transcript()` method for YouTube Transcript API
16-
- Added `youtube_trainability()` method for YouTube Trainability API
17+
- Added `youtube_subtitles()` method for YouTube Subtitles API
1718
- Added `chatgpt()` method for ChatGPT API
19+
- Added `gemini()` method for Gemini API
1820
- Added `usage()` method for Usage API
1921
- Refactored internal `request()` method to be API-agnostic
2022

2123
### Deprecated
2224

23-
- `get()` and `post()` methods are deprecated in favor of `html_api()` method
25+
- `get()` and `post()` are deprecated in favor of `html_api()` and will be removed in version 3.0.0.
2426

2527
## [2.0.2](https://github.com/ScrapingBee/scrapingbee-python/compare/v2.0.1...v2.0.2) (2025-10-02)
2628

@@ -47,4 +49,4 @@
4749

4850
### Breaking change
4951

50-
- No need to url encode params anymore.
52+
- No need to url encode params anymore.

README.md

Lines changed: 61 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ Signup to ScrapingBee to [get your API key](https://app.scrapingbee.com/account/
2424

2525
- [HTML API](#html-api)
2626
- [Google Search API](#google-search-api)
27+
- [Fast Search API](#fast-search-api)
2728
- [Amazon API](#amazon-api)
2829
- [Walmart API](#walmart-api)
2930
- [YouTube API](#youtube-api)
3031
- [ChatGPT API](#chatgpt-api)
32+
- [Gemini API](#gemini-api)
3133
- [Usage API](#usage-api)
3234

3335
---
@@ -86,9 +88,28 @@ print(response.json())
8688

8789
---
8890

91+
## Fast Search API
92+
93+
Lightweight Google search results in under a second.
94+
95+
```python
96+
response = client.fast_search(
97+
search='pizza in new york',
98+
params={
99+
'country_code': 'us',
100+
'language': 'en',
101+
'page': 1
102+
}
103+
)
104+
105+
print(response.json())
106+
```
107+
108+
---
109+
89110
## Amazon API
90111

91-
Scrape Amazon search results and product details.
112+
Scrape Amazon search results, product details, and pricing.
92113

93114
### Amazon Search
94115

@@ -118,6 +139,20 @@ response = client.amazon_product(
118139
print(response.json())
119140
```
120141

142+
### Amazon Pricing
143+
144+
```python
145+
response = client.amazon_pricing(
146+
asin='B0DPDRNSXV',
147+
params={
148+
'domain': 'com',
149+
'light_request': True
150+
}
151+
)
152+
153+
print(response.json())
154+
```
155+
121156
---
122157

123158
## Walmart API
@@ -155,7 +190,7 @@ print(response.json())
155190

156191
## YouTube API
157192

158-
Scrape YouTube search results, video metadata, and transcripts.
193+
Scrape YouTube search results, video metadata, and subtitles.
159194

160195
### YouTube Search
161196

@@ -178,23 +213,19 @@ response = client.youtube_metadata(video_id='dQw4w9WgXcQ')
178213
print(response.json())
179214
```
180215

181-
### YouTube Transcript
216+
### YouTube Subtitles
182217

183218
```python
184-
response = client.youtube_transcript(
219+
response = client.youtube_subtitles(
185220
video_id='dQw4w9WgXcQ',
186-
params={'language': 'en'}
221+
params={
222+
'language': 'en',
223+
'subtitle_origin': 'uploader_provided'
224+
}
187225
)
188226
print(response.json())
189227
```
190228

191-
### YouTube Trainability
192-
193-
```python
194-
response = client.youtube_trainability(video_id='dQw4w9WgXcQ')
195-
print(response.json())
196-
```
197-
198229
---
199230

200231
## ChatGPT API
@@ -215,6 +246,24 @@ print(response.json())
215246

216247
---
217248

249+
## Gemini API
250+
251+
Send prompts to Gemini and receive AI-generated responses.
252+
253+
```python
254+
response = client.gemini(
255+
prompt='Best programming languages for data science',
256+
params={
257+
'country_code': 'us',
258+
'add_html': False
259+
}
260+
)
261+
262+
print(response.json())
263+
```
264+
265+
---
266+
218267
## Usage API
219268

220269
Check your API credit usage.

manual-test.py

Lines changed: 83 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,33 @@ def test_google_search():
312312
raise
313313

314314

315+
# ============================================
316+
# Fast Search API
317+
# ============================================
318+
319+
def test_fast_search():
320+
print("=== Testing Fast Search API ===")
321+
try:
322+
response = client.fast_search(
323+
search="scrapingbee",
324+
params={"country_code": "us", "language": "en"}
325+
)
326+
327+
assert_test(response.status_code == 200, f"Expected status 200, got {response.status_code}")
328+
329+
data = response.json()
330+
assert_test(data.get("organic"), "Missing organic in response")
331+
assert_test(isinstance(data.get("organic"), list), "organic is not a list")
332+
assert_test(len(data.get("organic", [])) > 0, "No organic results found")
333+
334+
print(f"Status: {response.status_code}")
335+
print(f"Results found: {len(data.get('organic', []))}")
336+
print("✅ Fast Search test passed!\n")
337+
except Exception as e:
338+
print(f"❌ Fast Search test failed: {e}\n")
339+
raise
340+
341+
315342
# ============================================
316343
# Amazon API
317344
# ============================================
@@ -360,6 +387,28 @@ def test_amazon_product():
360387
raise
361388

362389

390+
def test_amazon_pricing():
391+
print("=== Testing Amazon Pricing API ===")
392+
try:
393+
response = client.amazon_pricing(
394+
asin="B0DPDRNSXV",
395+
params={"domain": "com"}
396+
)
397+
398+
assert_test(response.status_code == 200, f"Expected status 200, got {response.status_code}")
399+
400+
data = response.json()
401+
assert_test(data.get("pricing") is not None or data.get("asin"), "Missing pricing data in response")
402+
403+
print(f"Status: {response.status_code}")
404+
print(f"ASIN: {data.get('asin')}")
405+
print(f"Offers: {len(data.get('pricing', []))}")
406+
print("✅ Amazon Pricing test passed!\n")
407+
except Exception as e:
408+
print(f"❌ Amazon Pricing test failed: {e}\n")
409+
raise
410+
411+
363412
# ============================================
364413
# Walmart API
365414
# ============================================
@@ -453,56 +502,63 @@ def test_youtube_metadata():
453502
raise
454503

455504

456-
def test_youtube_transcript():
457-
print("=== Testing YouTube Transcript API ===")
505+
def test_youtube_subtitles():
506+
print("=== Testing YouTube Subtitles API ===")
458507
try:
459-
response = client.youtube_transcript(
460-
video_id="sfyL4BswUeE",
508+
response = client.youtube_subtitles(
509+
video_id="dQw4w9WgXcQ",
461510
params={"language": "en"}
462511
)
463512

464513
assert_test(response.status_code == 200, f"Expected status 200, got {response.status_code}")
465514

466515
data = response.json()
467-
assert_test(data.get("text") or data.get("transcript"), "Missing transcript in response")
516+
assert_test(data.get("subtitles"), "Missing subtitles in response")
468517

469-
transcript_preview = (data.get("text") or str(data.get("transcript", "")))[:100]
470518
print(f"Status: {response.status_code}")
471-
print(f"Transcript preview: {transcript_preview}")
472-
print("✅ YouTube Transcript test passed!\n")
519+
print(f"Subtitle origins: {list(data.get('subtitles', {}).keys())}")
520+
print("✅ YouTube Subtitles test passed!\n")
473521
except Exception as e:
474-
print(f"❌ YouTube Transcript test failed: {e}\n")
522+
print(f"❌ YouTube Subtitles test failed: {e}\n")
475523
raise
476524

477525

478-
def test_youtube_trainability():
479-
print("=== Testing YouTube Trainability API ===")
526+
# ============================================
527+
# ChatGPT API
528+
# ============================================
529+
530+
def test_chatgpt():
531+
print("=== Testing ChatGPT API ===")
480532
try:
481-
response = client.youtube_trainability(video_id="dQw4w9WgXcQ")
533+
response = client.chatgpt(
534+
prompt="What is web scraping? Answer in one sentence.",
535+
params={"search": True}
536+
)
482537

483538
assert_test(response.status_code == 200, f"Expected status 200, got {response.status_code}")
484539

485540
data = response.json()
486-
assert_test(data.get("permitted") is not None, "Missing permitted field in response")
541+
assert_test(data.get("results_text") or data.get("results_markdown"), "Missing response text")
487542

543+
response_text = (data.get("results_text") or data.get("results_markdown", ""))[:100]
488544
print(f"Status: {response.status_code}")
489-
print(f"Permitted: {data.get('permitted')}")
490-
print("✅ YouTube Trainability test passed!\n")
545+
print(f"Response: {response_text}")
546+
print("✅ ChatGPT test passed!\n")
491547
except Exception as e:
492-
print(f"❌ YouTube Trainability test failed: {e}\n")
548+
print(f"❌ ChatGPT test failed: {e}\n")
493549
raise
494550

495551

496552
# ============================================
497-
# ChatGPT API
553+
# Gemini API
498554
# ============================================
499555

500-
def test_chatgpt():
501-
print("=== Testing ChatGPT API ===")
556+
def test_gemini():
557+
print("=== Testing Gemini API ===")
502558
try:
503-
response = client.chatgpt(
559+
response = client.gemini(
504560
prompt="What is web scraping? Answer in one sentence.",
505-
params={"search": True}
561+
params={"country_code": "us"}
506562
)
507563

508564
assert_test(response.status_code == 200, f"Expected status 200, got {response.status_code}")
@@ -513,9 +569,9 @@ def test_chatgpt():
513569
response_text = (data.get("results_text") or data.get("results_markdown", ""))[:100]
514570
print(f"Status: {response.status_code}")
515571
print(f"Response: {response_text}")
516-
print("✅ ChatGPT test passed!\n")
572+
print("✅ Gemini test passed!\n")
517573
except Exception as e:
518-
print(f"❌ ChatGPT test failed: {e}\n")
574+
print(f"❌ Gemini test failed: {e}\n")
519575
raise
520576

521577

@@ -570,15 +626,17 @@ def run_tests():
570626

571627
# Other APIs
572628
test_google_search,
629+
test_fast_search,
573630
test_amazon_search,
574631
test_amazon_product,
632+
test_amazon_pricing,
575633
test_walmart_search,
576634
test_walmart_product,
577635
test_youtube_search,
578636
test_youtube_metadata,
579-
test_youtube_transcript,
580-
test_youtube_trainability,
637+
test_youtube_subtitles,
581638
test_chatgpt,
639+
test_gemini,
582640
test_usage,
583641
]
584642

0 commit comments

Comments
 (0)