Skip to content

Commit f91c76f

Browse files
author
stlc-bot
committed
feat(scrape): add g2-reviews prebuilt parser (#1933)
Stainless-Generated-From: eb89afdde0b42786e66e41af2130cb057736b8c8
1 parent ada9d68 commit f91c76f

4 files changed

Lines changed: 72 additions & 48 deletions

File tree

‎src/context/dev/types/batch_get_results_response.py‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ class DataOkResultMetadata(BaseModel):
294294

295295
class DataOkResultParsed(BaseModel):
296296
"""
297-
Custom rules return fields after content filters; unmatched fields are null ([] for lists). The google-maps parser returns business records in data.results, google-maps-reviews returns data.reviews, and the google-play parser returns one app record as data, google-play-reviews returns data.reviews, app-store and app-store-reviews do the same for the App Store, emails, phone-numbers, and links return data.emails, data.phone_numbers, and data.links from the rendered page; the store and Maps parsers read their data directly, independently of DOM filters and other outputs.
297+
Custom rules return fields after content filters; unmatched fields are null ([] for lists). The google-maps parser returns business records in data.results, google-maps-reviews returns data.reviews, and the google-play parser returns one app record as data, google-play-reviews returns data.reviews, app-store and app-store-reviews do the same for the App Store, g2-reviews returns data.reviews for a G2 product, emails, phone-numbers, and links return data.emails, data.phone_numbers, and data.links from the rendered page; the store, Maps, and G2 parsers read their data directly, independently of DOM filters and other outputs.
298298
"""
299299

300300
data: Optional[Dict[str, object]] = None
@@ -312,6 +312,7 @@ class DataOkResultParsed(BaseModel):
312312
"google-play-reviews",
313313
"app-store",
314314
"app-store-reviews",
315+
"g2-reviews",
315316
"emails",
316317
"phone-numbers",
317318
"links",
@@ -506,10 +507,11 @@ class DataOkResult(BaseModel):
506507
for lists). The google-maps parser returns business records in data.results,
507508
google-maps-reviews returns data.reviews, and the google-play parser returns one
508509
app record as data, google-play-reviews returns data.reviews, app-store and
509-
app-store-reviews do the same for the App Store, emails, phone-numbers, and
510-
links return data.emails, data.phone_numbers, and data.links from the rendered
511-
page; the store and Maps parsers read their data directly, independently of DOM
512-
filters and other outputs.
510+
app-store-reviews do the same for the App Store, g2-reviews returns data.reviews
511+
for a G2 product, emails, phone-numbers, and links return data.emails,
512+
data.phone_numbers, and data.links from the rendered page; the store, Maps, and
513+
G2 parsers read their data directly, independently of DOM filters and other
514+
outputs.
513515
"""
514516

515517
product: DataOkResultProduct
@@ -811,7 +813,7 @@ class DataErrorResultMetadata(BaseModel):
811813

812814
class DataErrorResultParsed(BaseModel):
813815
"""
814-
Custom rules return fields after content filters; unmatched fields are null ([] for lists). The google-maps parser returns business records in data.results, google-maps-reviews returns data.reviews, and the google-play parser returns one app record as data, google-play-reviews returns data.reviews, app-store and app-store-reviews do the same for the App Store, emails, phone-numbers, and links return data.emails, data.phone_numbers, and data.links from the rendered page; the store and Maps parsers read their data directly, independently of DOM filters and other outputs.
816+
Custom rules return fields after content filters; unmatched fields are null ([] for lists). The google-maps parser returns business records in data.results, google-maps-reviews returns data.reviews, and the google-play parser returns one app record as data, google-play-reviews returns data.reviews, app-store and app-store-reviews do the same for the App Store, g2-reviews returns data.reviews for a G2 product, emails, phone-numbers, and links return data.emails, data.phone_numbers, and data.links from the rendered page; the store, Maps, and G2 parsers read their data directly, independently of DOM filters and other outputs.
815817
"""
816818

817819
data: Optional[Dict[str, object]] = None
@@ -829,6 +831,7 @@ class DataErrorResultParsed(BaseModel):
829831
"google-play-reviews",
830832
"app-store",
831833
"app-store-reviews",
834+
"g2-reviews",
832835
"emails",
833836
"phone-numbers",
834837
"links",
@@ -1024,10 +1027,11 @@ class DataErrorResult(BaseModel):
10241027
for lists). The google-maps parser returns business records in data.results,
10251028
google-maps-reviews returns data.reviews, and the google-play parser returns one
10261029
app record as data, google-play-reviews returns data.reviews, app-store and
1027-
app-store-reviews do the same for the App Store, emails, phone-numbers, and
1028-
links return data.emails, data.phone_numbers, and data.links from the rendered
1029-
page; the store and Maps parsers read their data directly, independently of DOM
1030-
filters and other outputs.
1030+
app-store-reviews do the same for the App Store, g2-reviews returns data.reviews
1031+
for a G2 product, emails, phone-numbers, and links return data.emails,
1032+
data.phone_numbers, and data.links from the rendered page; the store, Maps, and
1033+
G2 parsers read their data directly, independently of DOM filters and other
1034+
outputs.
10311035
"""
10321036

10331037
product: DataErrorResultProduct

‎src/context/dev/types/batch_submit_params.py‎

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ class InputScrapeDataParseParamsPrebuiltParser(TypedDict, total=False):
247247
"google-play-reviews",
248248
"app-store",
249249
"app-store-reviews",
250+
"g2-reviews",
250251
"emails",
251252
"phone-numbers",
252253
"links",
@@ -272,17 +273,22 @@ class InputScrapeDataParseParamsPrebuiltParser(TypedDict, total=False):
272273
data: details, developer, ratings, price, version, and screenshots.
273274
app-store-reviews returns up to the 500 newest reviews in data.reviews. Both App
274275
Store parsers accept app URLs (apps.apple.com/us/app/…/id…); the country in the
275-
path sets the storefront, defaulting to us. emails accepts any page and returns
276-
its email addresses as data.emails ([{ email }]), read from mailto links,
277-
Cloudflare-protected addresses, and visible text. phone-numbers accepts any page
278-
and returns its valid phone numbers in E.164 as data.phone_numbers ([{ phone
279-
}]), read from tel links and visible text; numbers without a country code are
280-
read for the country of the site TLD, defaulting to US. links accepts any page
281-
and returns its unique http(s) links as data.links ([{ url, text }]), with
282-
absolute URLs; text falls back to aria-label or image alt and is null when a
283-
link has none. The emails parser reads the rendered page and respects content
284-
filters; the other prebuilt parsers read their data independently of DOM
285-
filters.
276+
path sets the storefront, defaulting to us. g2-reviews returns the 25 most
277+
recently published reviews of a G2 product in data.reviews (rating, title,
278+
likes, dislikes, problems_solved, reviewer role, company size, and industry),
279+
plus data.product. It accepts G2 product URLs (g2.com/products/…), follows
280+
renamed products, and keeps star-rating filters from the URL
281+
(filters[nps_score][]=1 to 5); other filters, sort orders, and pages are
282+
ignored. emails accepts any page and returns its email addresses as data.emails
283+
([{ email }]), read from mailto links, Cloudflare-protected addresses, and
284+
visible text. phone-numbers accepts any page and returns its valid phone numbers
285+
in E.164 as data.phone_numbers ([{ phone }]), read from tel links and visible
286+
text; numbers without a country code are read for the country of the site TLD,
287+
defaulting to US. links accepts any page and returns its unique http(s) links as
288+
data.links ([{ url, text }]), with absolute URLs; text falls back to aria-label
289+
or image alt and is null when a link has none. The emails parser reads the
290+
rendered page and respects content filters; the other prebuilt parsers read
291+
their data independently of DOM filters.
286292
"""
287293

288294
type: Required[Literal["prebuilt"]]
@@ -812,6 +818,7 @@ class InputCrawlDataParseParamsPrebuiltParser(TypedDict, total=False):
812818
"google-play-reviews",
813819
"app-store",
814820
"app-store-reviews",
821+
"g2-reviews",
815822
"emails",
816823
"phone-numbers",
817824
"links",
@@ -837,17 +844,22 @@ class InputCrawlDataParseParamsPrebuiltParser(TypedDict, total=False):
837844
data: details, developer, ratings, price, version, and screenshots.
838845
app-store-reviews returns up to the 500 newest reviews in data.reviews. Both App
839846
Store parsers accept app URLs (apps.apple.com/us/app/…/id…); the country in the
840-
path sets the storefront, defaulting to us. emails accepts any page and returns
841-
its email addresses as data.emails ([{ email }]), read from mailto links,
842-
Cloudflare-protected addresses, and visible text. phone-numbers accepts any page
843-
and returns its valid phone numbers in E.164 as data.phone_numbers ([{ phone
844-
}]), read from tel links and visible text; numbers without a country code are
845-
read for the country of the site TLD, defaulting to US. links accepts any page
846-
and returns its unique http(s) links as data.links ([{ url, text }]), with
847-
absolute URLs; text falls back to aria-label or image alt and is null when a
848-
link has none. The emails parser reads the rendered page and respects content
849-
filters; the other prebuilt parsers read their data independently of DOM
850-
filters.
847+
path sets the storefront, defaulting to us. g2-reviews returns the 25 most
848+
recently published reviews of a G2 product in data.reviews (rating, title,
849+
likes, dislikes, problems_solved, reviewer role, company size, and industry),
850+
plus data.product. It accepts G2 product URLs (g2.com/products/…), follows
851+
renamed products, and keeps star-rating filters from the URL
852+
(filters[nps_score][]=1 to 5); other filters, sort orders, and pages are
853+
ignored. emails accepts any page and returns its email addresses as data.emails
854+
([{ email }]), read from mailto links, Cloudflare-protected addresses, and
855+
visible text. phone-numbers accepts any page and returns its valid phone numbers
856+
in E.164 as data.phone_numbers ([{ phone }]), read from tel links and visible
857+
text; numbers without a country code are read for the country of the site TLD,
858+
defaulting to US. links accepts any page and returns its unique http(s) links as
859+
data.links ([{ url, text }]), with absolute URLs; text falls back to aria-label
860+
or image alt and is null when a link has none. The emails parser reads the
861+
rendered page and respects content filters; the other prebuilt parsers read
862+
their data independently of DOM filters.
851863
"""
852864

853865
type: Required[Literal["prebuilt"]]

‎src/context/dev/types/web_scrape_params.py‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ class ParseParamsPrebuiltParser(TypedDict, total=False):
215215
"google-play-reviews",
216216
"app-store",
217217
"app-store-reviews",
218+
"g2-reviews",
218219
"emails",
219220
"phone-numbers",
220221
"links",
@@ -240,17 +241,22 @@ class ParseParamsPrebuiltParser(TypedDict, total=False):
240241
data: details, developer, ratings, price, version, and screenshots.
241242
app-store-reviews returns up to the 500 newest reviews in data.reviews. Both App
242243
Store parsers accept app URLs (apps.apple.com/us/app/…/id…); the country in the
243-
path sets the storefront, defaulting to us. emails accepts any page and returns
244-
its email addresses as data.emails ([{ email }]), read from mailto links,
245-
Cloudflare-protected addresses, and visible text. phone-numbers accepts any page
246-
and returns its valid phone numbers in E.164 as data.phone_numbers ([{ phone
247-
}]), read from tel links and visible text; numbers without a country code are
248-
read for the country of the site TLD, defaulting to US. links accepts any page
249-
and returns its unique http(s) links as data.links ([{ url, text }]), with
250-
absolute URLs; text falls back to aria-label or image alt and is null when a
251-
link has none. The emails parser reads the rendered page and respects content
252-
filters; the other prebuilt parsers read their data independently of DOM
253-
filters.
244+
path sets the storefront, defaulting to us. g2-reviews returns the 25 most
245+
recently published reviews of a G2 product in data.reviews (rating, title,
246+
likes, dislikes, problems_solved, reviewer role, company size, and industry),
247+
plus data.product. It accepts G2 product URLs (g2.com/products/…), follows
248+
renamed products, and keeps star-rating filters from the URL
249+
(filters[nps_score][]=1 to 5); other filters, sort orders, and pages are
250+
ignored. emails accepts any page and returns its email addresses as data.emails
251+
([{ email }]), read from mailto links, Cloudflare-protected addresses, and
252+
visible text. phone-numbers accepts any page and returns its valid phone numbers
253+
in E.164 as data.phone_numbers ([{ phone }]), read from tel links and visible
254+
text; numbers without a country code are read for the country of the site TLD,
255+
defaulting to US. links accepts any page and returns its unique http(s) links as
256+
data.links ([{ url, text }]), with absolute URLs; text falls back to aria-label
257+
or image alt and is null when a link has none. The emails parser reads the
258+
rendered page and respects content filters; the other prebuilt parsers read
259+
their data independently of DOM filters.
254260
"""
255261

256262
type: Required[Literal["prebuilt"]]

‎src/context/dev/types/web_scrape_response.py‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class Metadata(BaseModel):
267267

268268
class Parsed(BaseModel):
269269
"""
270-
Custom rules return fields after content filters; unmatched fields are null ([] for lists). The google-maps parser returns business records in data.results, google-maps-reviews returns data.reviews, and the google-play parser returns one app record as data, google-play-reviews returns data.reviews, app-store and app-store-reviews do the same for the App Store, emails, phone-numbers, and links return data.emails, data.phone_numbers, and data.links from the rendered page; the store and Maps parsers read their data directly, independently of DOM filters and other outputs.
270+
Custom rules return fields after content filters; unmatched fields are null ([] for lists). The google-maps parser returns business records in data.results, google-maps-reviews returns data.reviews, and the google-play parser returns one app record as data, google-play-reviews returns data.reviews, app-store and app-store-reviews do the same for the App Store, g2-reviews returns data.reviews for a G2 product, emails, phone-numbers, and links return data.emails, data.phone_numbers, and data.links from the rendered page; the store, Maps, and G2 parsers read their data directly, independently of DOM filters and other outputs.
271271
"""
272272

273273
data: Optional[Dict[str, object]] = None
@@ -285,6 +285,7 @@ class Parsed(BaseModel):
285285
"google-play-reviews",
286286
"app-store",
287287
"app-store-reviews",
288+
"g2-reviews",
288289
"emails",
289290
"phone-numbers",
290291
"links",
@@ -475,10 +476,11 @@ class WebScrapeResponse(BaseModel):
475476
for lists). The google-maps parser returns business records in data.results,
476477
google-maps-reviews returns data.reviews, and the google-play parser returns one
477478
app record as data, google-play-reviews returns data.reviews, app-store and
478-
app-store-reviews do the same for the App Store, emails, phone-numbers, and
479-
links return data.emails, data.phone_numbers, and data.links from the rendered
480-
page; the store and Maps parsers read their data directly, independently of DOM
481-
filters and other outputs.
479+
app-store-reviews do the same for the App Store, g2-reviews returns data.reviews
480+
for a G2 product, emails, phone-numbers, and links return data.emails,
481+
data.phone_numbers, and data.links from the rendered page; the store, Maps, and
482+
G2 parsers read their data directly, independently of DOM filters and other
483+
outputs.
482484
"""
483485

484486
product: Product

0 commit comments

Comments
 (0)