Skip to content

Commit 0880245

Browse files
authored
Merge pull request #35 from karaposu/dev
Add Browser API docs, Discover API, Pinterest scraper; remove CLI
2 parents 89f6173 + 2b5d418 commit 0880245

34 files changed

Lines changed: 2799 additions & 1687 deletions

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,31 @@ async with BrightDataClient() as client:
135135
- `client.scrape.instagram` - profiles, posts, comments, reels
136136
- `client.scrape.facebook` - posts, comments, reels
137137

138+
### Browser API
139+
140+
Cloud-hosted Chrome instances accessible via the Chrome DevTools Protocol (CDP). The SDK builds the connection URL — you drive the browser with Playwright, Puppeteer, or Selenium.
141+
142+
```python
143+
from brightdata import BrightDataClient
144+
from playwright.async_api import async_playwright
145+
146+
client = BrightDataClient(
147+
browser_username="brd-customer-<id>-zone-<zone>",
148+
browser_password="<password>",
149+
)
150+
151+
url = client.browser.get_connect_url(country="us") # country is optional
152+
153+
async with async_playwright() as pw:
154+
browser = await pw.chromium.connect_over_cdp(url)
155+
page = await browser.new_page()
156+
await page.goto("https://example.com")
157+
html = await page.content()
158+
await browser.close()
159+
```
160+
161+
**When to use:** sites that require full browser automation — JS rendering, login flows, interactive clicks. For plain HTML fetches, prefer `client.scrape_url()`.
162+
138163
## Datasets API
139164

140165
Access 100+ ready-made datasets from Bright Data — pre-collected, structured data from popular platforms.

notebooks/01_quickstart.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@
278278
],
279279
"metadata": {
280280
"kernelspec": {
281-
"display_name": ".venv",
281+
"display_name": ".venv (3.11.10)",
282282
"language": "python",
283283
"name": "python3"
284284
},

notebooks/02_pandas_integration.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@
612612
],
613613
"metadata": {
614614
"kernelspec": {
615-
"display_name": ".venv",
615+
"display_name": ".venv (3.11.10)",
616616
"language": "python",
617617
"name": "python3"
618618
},

notebooks/03_serp.ipynb

Lines changed: 27 additions & 208 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"name": "stdout",
3333
"output_type": "stream",
3434
"text": [
35-
"API Token: 7011787d-2...3336\n",
35+
"API Token: 859a9772-4...4362\n",
3636
"Setup complete!\n"
3737
]
3838
}
@@ -59,7 +59,7 @@
5959
},
6060
{
6161
"cell_type": "code",
62-
"execution_count": 4,
62+
"execution_count": 2,
6363
"metadata": {},
6464
"outputs": [
6565
{
@@ -85,27 +85,9 @@
8585
},
8686
{
8787
"cell_type": "code",
88-
"execution_count": 5,
88+
"execution_count": null,
8989
"metadata": {},
90-
"outputs": [
91-
{
92-
"name": "stdout",
93-
"output_type": "stream",
94-
"text": [
95-
"Name: brightdata-sdk\n",
96-
"Version: 2.1.2\n",
97-
"Summary: Modern async-first Python SDK for Bright Data APIs\n",
98-
"Home-page: https://github.com/brightdata/sdk-python\n",
99-
"Author: Bright Data\n",
100-
"Author-email: Bright Data <support@brightdata.com>\n",
101-
"License: MIT\n",
102-
"Location: /Users/ns/Desktop/projects/sdk-python/.venv/lib/python3.11/site-packages\n",
103-
"Editable project location: /Users/ns/Desktop/projects/sdk-python\n",
104-
"Requires: aiohttp, aiolimiter, click, pydantic, pydantic-settings, python-dotenv, requests, tldextract\n",
105-
"Required-by: \n"
106-
]
107-
}
108-
],
90+
"outputs": [],
10991
"source": [
11092
"!pip show brightdata-sdk "
11193
]
@@ -122,7 +104,7 @@
122104
},
123105
{
124106
"cell_type": "code",
125-
"execution_count": 6,
107+
"execution_count": 3,
126108
"metadata": {},
127109
"outputs": [
128110
{
@@ -138,21 +120,21 @@
138120
"\n",
139121
"--- Top 5 Results ---\n",
140122
"\n",
141-
"1. The Python Tutorial — Python 3.14.3 documentation\n",
142-
" URL: https://docs.python.org/3/tutorial/index.html...\n",
143-
" Description: This tutorial introduces the reader informally to the basic concepts and feature...\n",
144-
"\n",
145-
"2. Python Tutorial\n",
123+
"1. Python Tutorial\n",
146124
" URL: https://www.w3schools.com/python/...\n",
147125
" Description: Learn Python. Python is a popular programming language. Python can be used on a ...\n",
148126
"\n",
149-
"3. Python For Beginners\n",
127+
"2. Python For Beginners\n",
150128
" URL: https://www.python.org/about/gettingstarted/...\n",
151129
" Description: Welcome! Are you completely new to programming? If not then we presume you will ...\n",
152130
"\n",
153-
"4. Best Python tutorial for beginners in 2024? : r/learnpython\n",
154-
" URL: https://www.reddit.com/r/learnpython/comments/1ajlvog/best_p...\n",
155-
" Description: I'm almost done with The Complete Python Bootcamp from Zero to Hero in Python th...\n",
131+
"3. Python Tutorial\n",
132+
" URL: https://www.geeksforgeeks.org/python/python-programming-lang...\n",
133+
" Description: In this section, we'll cover the basics of Python programming, including install...\n",
134+
"\n",
135+
"4. Python Tutorials\n",
136+
" URL: https://www.youtube.com/playlist?list=PL-osiE80TeTt2d9bfVyTi...\n",
137+
" Description: An in-depth look at the Python programming language. Learn about Python developm...\n",
156138
"\n",
157139
"5. Learn Python - Free Interactive Python Tutorial\n",
158140
" URL: https://www.learnpython.org/...\n",
@@ -200,43 +182,9 @@
200182
},
201183
{
202184
"cell_type": "code",
203-
"execution_count": 7,
185+
"execution_count": null,
204186
"metadata": {},
205-
"outputs": [
206-
{
207-
"name": "stdout",
208-
"output_type": "stream",
209-
"text": [
210-
"Query: 'best restaurants near me'\n",
211-
"Testing different locations...\n",
212-
"\n",
213-
"=== Location: New York, United States ===\n",
214-
" 1. Best Restaurants Near Me\n",
215-
" https://www.tripadvisor.com/Restaurants\n",
216-
" 2. Best Restaurants Near Me - February 2026\n",
217-
" https://www.yelp.com/nearme/restaurants\n",
218-
" 3. The 10 Best Restaurants Near Me in New York City, NY\n",
219-
" https://www.opentable.com/nearby/restaurants-near-me-new-york-city\n",
220-
"\n",
221-
"=== Location: London, United Kingdom ===\n",
222-
" 1. Best Restaurants Near Me\n",
223-
" https://www.tripadvisor.com/Restaurants\n",
224-
" 2. TOP 10 BEST Restaurants near Bentonville, AR\n",
225-
" https://www.yelp.com/c/bentonville-ar-us/restaurants\n",
226-
" 3. The Best Restaurants Open Near Me - TheFork\n",
227-
" https://www.thefork.com/near-me\n",
228-
"\n",
229-
"=== Location: Tokyo, Japan ===\n",
230-
" 1. Best Restaurants Near Me\n",
231-
" https://www.tripadvisor.com/Restaurants\n",
232-
" 2. 10 Best Punta Gorda Restaurants that Prove it's a Foodie ...\n",
233-
" https://rtwin30days.com/best-punta-gorda-restaurants/\n",
234-
" 3. The Best Places to Eat in St. Augustine, Florida\n",
235-
" https://currentlytraveling.com/the-best-places-to-eat-in-st-augustine-florida/\n",
236-
"\n"
237-
]
238-
}
239-
],
187+
"outputs": [],
240188
"source": [
241189
"QUERY = \"best restaurants near me\"\n",
242190
"\n",
@@ -277,44 +225,9 @@
277225
},
278226
{
279227
"cell_type": "code",
280-
"execution_count": 8,
228+
"execution_count": null,
281229
"metadata": {},
282-
"outputs": [
283-
{
284-
"name": "stdout",
285-
"output_type": "stream",
286-
"text": [
287-
"Batch Google Search: 3 queries\n",
288-
"\n",
289-
"Results: 3 responses\n",
290-
"\n",
291-
"=== Query: 'python web scraping' ===\n",
292-
"Success: True\n",
293-
"Results found: 8\n",
294-
" 1. Python Web Scraping Tutorial\n",
295-
" https://www.geeksforgeeks.org/python/python-web-scraping-tutorial/\n",
296-
" 2. Beautiful Soup: Build a Web Scraper With Python\n",
297-
" https://realpython.com/beautiful-soup-web-scraper-python/\n",
298-
"\n",
299-
"=== Query: 'javascript async await' ===\n",
300-
"Success: True\n",
301-
"Results found: 10\n",
302-
" 1. async function - JavaScript - MDN Web Docs\n",
303-
" https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function\n",
304-
" 2. JavaScript async and await\n",
305-
" https://www.w3schools.com/js/js_async.asp\n",
306-
"\n",
307-
"=== Query: 'data science tools' ===\n",
308-
"Success: True\n",
309-
"Results found: 9\n",
310-
" 1. 13 Essential Data Science Tools (And How to Use Them)\n",
311-
" https://learning.linkedin.com/resources/learning-tech/how-to-use-13-essential-data-science-tools\n",
312-
" 2. If you had to list a “tier list” of software that data scien\n",
313-
" https://www.reddit.com/r/datascience/comments/184ezlq/if_you_had_to_list_a_tier_list_of_software_that/\n",
314-
"\n"
315-
]
316-
}
317-
],
230+
"outputs": [],
318231
"source": [
319232
"QUERIES = [\n",
320233
" \"python web scraping\",\n",
@@ -362,28 +275,9 @@
362275
},
363276
{
364277
"cell_type": "code",
365-
"execution_count": 9,
278+
"execution_count": null,
366279
"metadata": {},
367-
"outputs": [
368-
{
369-
"name": "stdout",
370-
"output_type": "stream",
371-
"text": [
372-
"Query: 'weather today'\n",
373-
"Comparing desktop vs mobile results...\n",
374-
"\n",
375-
"=== Desktop ===\n",
376-
" 1. National and Local Weather Radar, Daily Forecast, \n",
377-
" 2. Weather Forecast and Conditions for New York City,\n",
378-
" 3. Weather Forecast and Conditions for Austin, Texas\n",
379-
"\n",
380-
"=== Mobile ===\n",
381-
" 1. Spain Current Weather\n",
382-
" 2. Weather forecast by locations\n",
383-
" 3. 10-Day Weather Forecast for Valdeacederas, Tetuán \n"
384-
]
385-
}
386-
],
280+
"outputs": [],
387281
"source": [
388282
"QUERY = \"weather today\"\n",
389283
"\n",
@@ -427,29 +321,9 @@
427321
},
428322
{
429323
"cell_type": "code",
430-
"execution_count": 10,
324+
"execution_count": null,
431325
"metadata": {},
432-
"outputs": [
433-
{
434-
"name": "stdout",
435-
"output_type": "stream",
436-
"text": [
437-
"=== Result Metadata ===\n",
438-
"success: True\n",
439-
"search_engine: google\n",
440-
"query: {'q': 'weather today', 'location': None, 'language': 'en'}\n",
441-
"country: None\n",
442-
"results_per_page: 5\n",
443-
"total_found: None\n",
444-
"\n",
445-
"=== Timing ===\n",
446-
"trigger_sent_at: 2026-02-11 17:55:31.882102+00:00\n",
447-
"data_fetched_at: 2026-02-11 17:55:36.380537+00:00\n",
448-
"\n",
449-
"Total time: 4.50 seconds\n"
450-
]
451-
}
452-
],
326+
"outputs": [],
453327
"source": [
454328
"# Check timing metadata from last result\n",
455329
"print(\"=== Result Metadata ===\")\n",
@@ -478,18 +352,9 @@
478352
},
479353
{
480354
"cell_type": "code",
481-
"execution_count": 11,
355+
"execution_count": null,
482356
"metadata": {},
483-
"outputs": [
484-
{
485-
"name": "stdout",
486-
"output_type": "stream",
487-
"text": [
488-
"Exported to: /Users/ns/Desktop/projects/sdk-python/notebooks/serp_results.json\n",
489-
"Results count: 10\n"
490-
]
491-
}
492-
],
357+
"outputs": [],
493358
"source": [
494359
"import json\n",
495360
"from pathlib import Path\n",
@@ -529,55 +394,9 @@
529394
},
530395
{
531396
"cell_type": "code",
532-
"execution_count": 12,
397+
"execution_count": null,
533398
"metadata": {},
534-
"outputs": [
535-
{
536-
"name": "stdout",
537-
"output_type": "stream",
538-
"text": [
539-
"Query: 'machine learning frameworks'\n",
540-
"Requesting 30 results (pagination will fetch ~3 pages)...\n",
541-
"\n",
542-
"Success: True\n",
543-
"Results returned: 30\n",
544-
"Total found (Google estimate): None\n",
545-
"Results per page: 10\n",
546-
"\n",
547-
"--- All 30 Results ---\n",
548-
" 1. Top 10 Machine Learning Frameworks in 2025\n",
549-
" 2. Machine Learning Frameworks and Languages\n",
550-
" 3. Machine Learning Framework Preferences in the Industry\n",
551-
" 4. Machine and Deep Learning Frameworks\n",
552-
" 5. What Are Machine Learning Frameworks?\n",
553-
" 6. Top 10 Machine Learning Frameworks (2026)\n",
554-
" 7. Machine learning frameworks\n",
555-
" 8. Machine Learning Frameworks: Features, Use Cases ...\n",
556-
" 9. Top Machine Learning Frameworks To Use\n",
557-
"10. What Is a Machine Learning Pipeline?\n",
558-
"11. josephmisiti/awesome-machine-learning: A curated list o\n",
559-
"12. Effective Machine Learning Frameworks\n",
560-
"13. The Top 16 AI Frameworks and Libraries: A Beginner's Gu\n",
561-
"14. What Are Machine Learning Frameworks and How to Pick ..\n",
562-
"15. YouTube\n",
563-
"16. Top 20 Machine Learning Frameworks Of All Times\n",
564-
"17. Comparison of ML Frameworks\n",
565-
"18. Machine learning frameworks: Choosing the right one\n",
566-
"19. 15 Popular Machine Learning Frameworks for Model ...\n",
567-
"20. Best Machine Learning Frameworks(ML) for Experts in 202\n",
568-
"21. PyTorch\n",
569-
"22. Top Machine Learning Frameworks to Use\n",
570-
"23. The State of Machine Learning Frameworks in 2019\n",
571-
"24. Top 8 Deep Learning Frameworks You Should Know | 2025\n",
572-
"25. Machine Learning and Deep Learning frameworks and ...\n",
573-
"26. Deep Learning Frameworks\n",
574-
"27. Machine Learning Frameworks: Features, Use Cases ...\n",
575-
"28. Comparison of deep learning software\n",
576-
"29. The Ultimate Guide to Machine Learning Frameworks\n",
577-
"30. Machine learning frameworks: Choosing the right one\n"
578-
]
579-
}
580-
],
399+
"outputs": [],
581400
"source": [
582401
"QUERY = \"machine learning frameworks\"\n",
583402
"NUM_RESULTS = 30 # Request 30 results (3 pages)\n",
@@ -666,7 +485,7 @@
666485
],
667486
"metadata": {
668487
"kernelspec": {
669-
"display_name": ".venv",
488+
"display_name": ".venv (3.11.10)",
670489
"language": "python",
671490
"name": "python3"
672491
},

0 commit comments

Comments
 (0)