scrapeunblocker-haystack 0.4.1__tar.gz → 0.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.2
4
+
5
+ - `ScrapeUnblockerWebSearch` adds `sitelinks` (the extra links under a result:
6
+ `title`, `url`, `description`), `rating` (`value`, `max`, `reviews`, `url`)
7
+ and `rich_snippet` (the facts line under the snippet) to each Document's
8
+ metadata, from the new `/serpApi` fields.
9
+
3
10
  ## 0.4.1
4
11
 
5
12
  - `ScrapeUnblockerWebSearch` adds `displayed_url`, `domain`, `source` (the
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: scrapeunblocker-haystack
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Haystack integration for ScrapeUnblocker - scrape pages behind anti-bot protections
5
5
  Project-URL: Homepage, https://www.scrapeunblocker.com
6
6
  Project-URL: Documentation, https://docs.scrapeunblocker.com
@@ -186,7 +186,8 @@ print(doc.content) # {"url": ..., "count": ..., "elements": [...]
186
186
 
187
187
  Searches Google and returns the organic results as `Document` objects, with the
188
188
  snippet as content and `title` / `link` / `position` / `displayed_url` / `domain` /
189
- `source` (the site's name) / `date` in the metadata.
189
+ `source` (the site's name) / `date` / `sitelinks` / `rating` / `rich_snippet` (the
190
+ facts line under the snippet) in the metadata.
190
191
 
191
192
  ```python
192
193
  from scrapeunblocker_haystack import ScrapeUnblockerWebSearch
@@ -161,7 +161,8 @@ print(doc.content) # {"url": ..., "count": ..., "elements": [...]
161
161
 
162
162
  Searches Google and returns the organic results as `Document` objects, with the
163
163
  snippet as content and `title` / `link` / `position` / `displayed_url` / `domain` /
164
- `source` (the site's name) / `date` in the metadata.
164
+ `source` (the site's name) / `date` / `sitelinks` / `rating` / `rich_snippet` (the
165
+ facts line under the snippet) in the metadata.
165
166
 
166
167
  ```python
167
168
  from scrapeunblocker_haystack import ScrapeUnblockerWebSearch
@@ -19,7 +19,7 @@ class ScrapeUnblockerWebSearch:
19
19
 
20
20
  Each result becomes a Document whose content is the snippet (the title when
21
21
  Google shows none), with the title, link, position, displayed URL, domain,
22
- site name and date in the metadata.
22
+ site name, date, sitelinks, star rating and facts line in the metadata.
23
23
 
24
24
  ### Usage example
25
25
 
@@ -112,6 +112,9 @@ class ScrapeUnblockerWebSearch:
112
112
  "domain": result.get("domain"),
113
113
  "source": result.get("source"),
114
114
  "date": result.get("date"),
115
+ "sitelinks": result.get("sitelinks") or [],
116
+ "rating": result.get("rating"),
117
+ "rich_snippet": result.get("richSnippet"),
115
118
  "query": query,
116
119
  },
117
120
  )
@@ -0,0 +1 @@
1
+ __version__ = "0.4.2"
@@ -213,7 +213,10 @@ class TestWebSearch:
213
213
  "organic": [
214
214
  {"title": "First", "url": "https://a.com", "description": "snippet a", "position": "1",
215
215
  "displayedUrl": "https://a.com › docs", "domain": "a.com", "source": "A",
216
- "date": "Oct 2, 2026"},
216
+ "date": "Oct 2, 2026",
217
+ "sitelinks": [{"title": "Docs", "url": "https://a.com/docs", "description": None}],
218
+ "rating": {"value": 4.5, "max": 5.0, "reviews": 120, "url": None},
219
+ "richSnippet": "4.5 (120) · Free"},
217
220
  {"title": "Second", "url": "https://b.com", "description": "snippet b", "position": "2"},
218
221
  ]
219
222
  }
@@ -231,6 +234,11 @@ class TestWebSearch:
231
234
  assert result["documents"][0].meta["source"] == "A"
232
235
  assert result["documents"][0].meta["date"] == "Oct 2, 2026"
233
236
  assert result["documents"][1].meta["date"] is None
237
+ assert result["documents"][0].meta["sitelinks"][0]["url"] == "https://a.com/docs"
238
+ assert result["documents"][0].meta["rating"]["value"] == 4.5
239
+ assert result["documents"][0].meta["rich_snippet"] == "4.5 (120) · Free"
240
+ assert result["documents"][1].meta["sitelinks"] == []
241
+ assert result["documents"][1].meta["rating"] is None
234
242
 
235
243
  _, kwargs = mock_post.call_args
236
244
  assert kwargs["params"]["keyword"] == "test query"
@@ -1 +0,0 @@
1
- __version__ = "0.4.1"