Skip to content

Commit bf8b812

Browse files
authored
Merge pull request #20 from Thordata/docs/readme-serp-engines
docs: recommend google_news/google_shopping engines in README
2 parents 931ea96 + 0c7ab75 commit bf8b812

File tree

1 file changed

+32
-21
lines changed

1 file changed

+32
-21
lines changed

README.md

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
[![CI](https://github.com/Thordata/thordata-python-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/Thordata/thordata-python-sdk/actions/workflows/ci.yml)
1010
[![PyPI version](https://img.shields.io/pypi/v/thordata-sdk?color=blue)](https://pypi.org/project/thordata-sdk/)
11-
[![Python](https://img.shields.io/badge/python-3.8+-blue)](https://python.org)
11+
[![Python](https://img.shields.io/badge/python-3.9+-blue)](https://python.org)
1212
[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
1313
[![Typed](https://img.shields.io/badge/typing-typed-purple)](https://github.com/Thordata/thordata-python-sdk)
1414

@@ -211,18 +211,29 @@ for result in results.get("organic", []):
211211
#### General Calling Method
212212

213213
```python
214-
from thordata import ThordataClient, Engine
214+
from thordata import ThordataClient
215215

216216
client = ThordataClient(scraper_token="YOUR_SCRAPER_TOKEN")
217217

218+
# Recommended: use dedicated engines for Google verticals when available
219+
news = client.serp_search(
220+
query="pizza",
221+
engine="google_news",
222+
country="us",
223+
language="en",
224+
num=10,
225+
so=1, # 0=relevance, 1=date (Google News)
226+
)
227+
228+
# Alternative: use Google generic engine + tbm via `search_type`
229+
# Note: `search_type` maps to Google tbm and is mainly intended for engine="google".
218230
results = client.serp_search(
219231
query="pizza",
220-
engine=Engine.GOOGLE, # or "google"
232+
engine="google",
221233
num=10,
222234
country="us",
223235
language="en",
224-
search_type="news", # corresponds to tbm=nws
225-
# Other parameters are passed in via kwargs
236+
search_type="news", # tbm=nws (Google generic engine)
226237
ibp="some_ibp_value",
227238
lsig="some_lsig_value",
228239
)
@@ -240,14 +251,14 @@ client = ThordataClient(scraper_token="your_token")
240251
# Create a detailed search request
241252
request = SerpRequest(
242253
query="best laptops 2024",
243-
engine="google",
254+
engine="google_shopping",
244255
num=20,
245256
country="us",
246257
language="en",
247-
search_type="shopping", # shopping, news, images, videos
248-
time_filter="month", # hour, day, week, month, year
249258
safe_search=True,
250-
device="mobile", # desktop, mobile, tablet
259+
device="mobile",
260+
# Shopping-specific params can be passed via extra_params
261+
# e.g. min_price=500, max_price=1500, sort_by=1, shoprs="..."
251262
)
252263

253264
results = client.serp_search_advanced(request)
@@ -323,19 +334,19 @@ results = client.serp_search(
323334

324335
### Google Shopping Parameter Mapping
325336

326-
Shopping still uses engine="google", search_type="shopping" to select Shopping mode:
337+
Recommended: use the dedicated Google Shopping engine (`engine="google_shopping"`):
327338

328339
```python
329340
results = client.serp_search(
330341
query="iPhone 15",
331-
engine=Engine.GOOGLE,
332-
search_type="shopping", # tbm=shop
342+
engine="google_shopping",
333343
country="us",
334344
language="en",
335345
num=20,
336-
min_price=500, # Parameters below passed through kwargs
346+
# Shopping parameters are passed through kwargs
347+
min_price=500,
337348
max_price=1500,
338-
sort_by=1, # 1=price low to high, 2=high to low
349+
sort_by=1,
339350
free_shipping=True,
340351
on_sale=True,
341352
small_business=True,
@@ -344,6 +355,7 @@ results = client.serp_search(
344355
)
345356
shopping_items = results.get("shopping_results", [])
346357
```
358+
Alternative: use `engine="google"` with `search_type="shopping"` (tbm=shop).
347359

348360
| Document Parameter | SDK Field/Usage | Description |
349361
|-------------------|-----------------|-------------|
@@ -440,15 +452,14 @@ Google News has a set of exclusive token parameters for precise control of "topi
440452
```python
441453
results = client.serp_search(
442454
query="AI regulation",
443-
engine=Engine.GOOGLE,
444-
search_type="news", # tbm=nws
455+
engine="google_news",
445456
country="us",
446457
language="en",
447-
topic_token="YOUR_TOPIC_TOKEN", # Optional
448-
publication_token="YOUR_PUBLICATION_TOKEN", # Optional
449-
section_token="YOUR_SECTION_TOKEN", # Optional
450-
story_token="YOUR_STORY_TOKEN", # Optional
451-
so=1, # 0=relevance, 1=time
458+
topic_token="YOUR_TOPIC_TOKEN",
459+
publication_token="YOUR_PUBLICATION_TOKEN",
460+
section_token="YOUR_SECTION_TOKEN",
461+
story_token="YOUR_STORY_TOKEN",
462+
so=1, # 0=relevance, 1=date
452463
)
453464
news_results = results.get("news_results", results.get("organic", []))
454465
```

0 commit comments

Comments
 (0)