Skip to content

Commit 3d8428b

Browse files
author
stlc-bot
committed
feat(scrape): add Yelp search parser
Merge pull request #2306 from context-dot-dev/feat/yelp-search-parser Stainless-Generated-From: 163fdec2b765044684ae40e57cd7342cb7548a41
1 parent 1a386c3 commit 3d8428b

4 files changed

Lines changed: 63 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, g2-reviews returns data.reviews for a G2 product, instagram-profile and instagram-post return one record as data, instagram-feed returns data.posts, tiktok-profile and tiktok-video return one record as data, tiktok-feed returns data.videos, tiktok-comments returns data.comments, tiktok-followers, tiktok-following, and tiktok-user-search return data.users, emails, phone-numbers, and links return data.emails, data.phone_numbers, and data.links from the rendered page; the store, Maps, G2, Instagram, and TikTok 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, instagram-profile and instagram-post return one record as data, instagram-feed returns data.posts, tiktok-profile and tiktok-video return one record as data, tiktok-feed returns data.videos, tiktok-comments returns data.comments, tiktok-followers, tiktok-following, and tiktok-user-search return data.users, yelp-search returns up to 20 ranked organic businesses in data.businesses, plus total and pagination, from a Yelp search URL; emails, phone-numbers, and links return data.emails, data.phone_numbers, and data.links from the rendered page; the store, Maps, G2, Instagram, and TikTok parsers read their data directly, independently of DOM filters and other outputs.
298298
"""
299299

300300
data: Optional[Dict[str, object]] = None
@@ -323,6 +323,7 @@ class DataOkResultParsed(BaseModel):
323323
"tiktok-followers",
324324
"tiktok-following",
325325
"tiktok-user-search",
326+
"yelp-search",
326327
"emails",
327328
"phone-numbers",
328329
"links",
@@ -522,10 +523,11 @@ class DataOkResult(BaseModel):
522523
data, instagram-feed returns data.posts, tiktok-profile and tiktok-video return
523524
one record as data, tiktok-feed returns data.videos, tiktok-comments returns
524525
data.comments, tiktok-followers, tiktok-following, and tiktok-user-search return
525-
data.users, emails, phone-numbers, and links return data.emails,
526-
data.phone_numbers, and data.links from the rendered page; the store, Maps, G2,
527-
Instagram, and TikTok parsers read their data directly, independently of DOM
528-
filters and other outputs.
526+
data.users, yelp-search returns up to 20 ranked organic businesses in
527+
data.businesses, plus total and pagination, from a Yelp search URL; emails,
528+
phone-numbers, and links return data.emails, data.phone_numbers, and data.links
529+
from the rendered page; the store, Maps, G2, Instagram, and TikTok parsers read
530+
their data directly, independently of DOM filters and other outputs.
529531
"""
530532

531533
product: DataOkResultProduct
@@ -827,7 +829,7 @@ class DataErrorResultMetadata(BaseModel):
827829

828830
class DataErrorResultParsed(BaseModel):
829831
"""
830-
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, instagram-profile and instagram-post return one record as data, instagram-feed returns data.posts, tiktok-profile and tiktok-video return one record as data, tiktok-feed returns data.videos, tiktok-comments returns data.comments, tiktok-followers, tiktok-following, and tiktok-user-search return data.users, emails, phone-numbers, and links return data.emails, data.phone_numbers, and data.links from the rendered page; the store, Maps, G2, Instagram, and TikTok parsers read their data directly, independently of DOM filters and other outputs.
832+
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, instagram-profile and instagram-post return one record as data, instagram-feed returns data.posts, tiktok-profile and tiktok-video return one record as data, tiktok-feed returns data.videos, tiktok-comments returns data.comments, tiktok-followers, tiktok-following, and tiktok-user-search return data.users, yelp-search returns up to 20 ranked organic businesses in data.businesses, plus total and pagination, from a Yelp search URL; emails, phone-numbers, and links return data.emails, data.phone_numbers, and data.links from the rendered page; the store, Maps, G2, Instagram, and TikTok parsers read their data directly, independently of DOM filters and other outputs.
831833
"""
832834

833835
data: Optional[Dict[str, object]] = None
@@ -856,6 +858,7 @@ class DataErrorResultParsed(BaseModel):
856858
"tiktok-followers",
857859
"tiktok-following",
858860
"tiktok-user-search",
861+
"yelp-search",
859862
"emails",
860863
"phone-numbers",
861864
"links",
@@ -1056,10 +1059,11 @@ class DataErrorResult(BaseModel):
10561059
data, instagram-feed returns data.posts, tiktok-profile and tiktok-video return
10571060
one record as data, tiktok-feed returns data.videos, tiktok-comments returns
10581061
data.comments, tiktok-followers, tiktok-following, and tiktok-user-search return
1059-
data.users, emails, phone-numbers, and links return data.emails,
1060-
data.phone_numbers, and data.links from the rendered page; the store, Maps, G2,
1061-
Instagram, and TikTok parsers read their data directly, independently of DOM
1062-
filters and other outputs.
1062+
data.users, yelp-search returns up to 20 ranked organic businesses in
1063+
data.businesses, plus total and pagination, from a Yelp search URL; emails,
1064+
phone-numbers, and links return data.emails, data.phone_numbers, and data.links
1065+
from the rendered page; the store, Maps, G2, Instagram, and TikTok parsers read
1066+
their data directly, independently of DOM filters and other outputs.
10631067
"""
10641068

10651069
product: DataErrorResultProduct

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

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,7 @@ class InputScrapeDataBatchUnifiedScrapeDataParseParamsPrebuiltParser(TypedDict,
894894
"tiktok-followers",
895895
"tiktok-following",
896896
"tiktok-user-search",
897+
"yelp-search",
897898
"emails",
898899
"phone-numbers",
899900
"links",
@@ -958,17 +959,19 @@ class InputScrapeDataBatchUnifiedScrapeDataParseParamsPrebuiltParser(TypedDict,
958959
(/search/user?q={query}) as data.users: id, username, nickname, biography,
959960
avatar_url, sec_uid, follower_count, like_count, and is_verified. The TikTok
960961
parsers accept tiktok.com, www.tiktok.com, and m.tiktok.com URLs but not short
961-
links (vm.tiktok.com, vt.tiktok.com, tiktok.com/t/…). emails accepts any page
962-
and returns its email addresses as data.emails ([{ email }]), read from mailto
963-
links, Cloudflare-protected addresses, and visible text. phone-numbers accepts
964-
any page and returns its valid phone numbers in E.164 as data.phone_numbers ([{
965-
phone }]), read from tel links and visible text; numbers without a country code
966-
are read for the country of the site TLD, defaulting to US. links accepts any
967-
page and returns its unique http(s) links as data.links ([{ url, text }]), with
968-
absolute URLs; text falls back to aria-label or image alt and is null when a
969-
link has none. The emails parser reads the rendered page and respects content
970-
filters; the other prebuilt parsers read their data independently of DOM
971-
filters.
962+
links (vm.tiktok.com, vt.tiktok.com, tiktok.com/t/…). yelp-search accepts Yelp
963+
search URLs with find_desc and find_loc, reads start as the result offset, and
964+
returns up to 20 ranked organic businesses in data.businesses with total and
965+
pagination. emails accepts any page and returns its email addresses as
966+
data.emails ([{ email }]), read from mailto links, Cloudflare-protected
967+
addresses, and visible text. phone-numbers accepts any page and returns its
968+
valid phone numbers in E.164 as data.phone_numbers ([{ phone }]), read from tel
969+
links and visible text; numbers without a country code are read for the country
970+
of the site TLD, defaulting to US. links accepts any page and returns its unique
971+
http(s) links as data.links ([{ url, text }]), with absolute URLs; text falls
972+
back to aria-label or image alt and is null when a link has none. The emails
973+
parser reads the rendered page and respects content filters; the other prebuilt
974+
parsers read their data independently of DOM filters.
972975
"""
973976

974977
type: Required[Literal["prebuilt"]]
@@ -2534,6 +2537,7 @@ class InputCrawlDataBatchUnifiedCrawlDataParseParamsPrebuiltParser(TypedDict, to
25342537
"tiktok-followers",
25352538
"tiktok-following",
25362539
"tiktok-user-search",
2540+
"yelp-search",
25372541
"emails",
25382542
"phone-numbers",
25392543
"links",
@@ -2598,17 +2602,19 @@ class InputCrawlDataBatchUnifiedCrawlDataParseParamsPrebuiltParser(TypedDict, to
25982602
(/search/user?q={query}) as data.users: id, username, nickname, biography,
25992603
avatar_url, sec_uid, follower_count, like_count, and is_verified. The TikTok
26002604
parsers accept tiktok.com, www.tiktok.com, and m.tiktok.com URLs but not short
2601-
links (vm.tiktok.com, vt.tiktok.com, tiktok.com/t/…). emails accepts any page
2602-
and returns its email addresses as data.emails ([{ email }]), read from mailto
2603-
links, Cloudflare-protected addresses, and visible text. phone-numbers accepts
2604-
any page and returns its valid phone numbers in E.164 as data.phone_numbers ([{
2605-
phone }]), read from tel links and visible text; numbers without a country code
2606-
are read for the country of the site TLD, defaulting to US. links accepts any
2607-
page and returns its unique http(s) links as data.links ([{ url, text }]), with
2608-
absolute URLs; text falls back to aria-label or image alt and is null when a
2609-
link has none. The emails parser reads the rendered page and respects content
2610-
filters; the other prebuilt parsers read their data independently of DOM
2611-
filters.
2605+
links (vm.tiktok.com, vt.tiktok.com, tiktok.com/t/…). yelp-search accepts Yelp
2606+
search URLs with find_desc and find_loc, reads start as the result offset, and
2607+
returns up to 20 ranked organic businesses in data.businesses with total and
2608+
pagination. emails accepts any page and returns its email addresses as
2609+
data.emails ([{ email }]), read from mailto links, Cloudflare-protected
2610+
addresses, and visible text. phone-numbers accepts any page and returns its
2611+
valid phone numbers in E.164 as data.phone_numbers ([{ phone }]), read from tel
2612+
links and visible text; numbers without a country code are read for the country
2613+
of the site TLD, defaulting to US. links accepts any page and returns its unique
2614+
http(s) links as data.links ([{ url, text }]), with absolute URLs; text falls
2615+
back to aria-label or image alt and is null when a link has none. The emails
2616+
parser reads the rendered page and respects content filters; the other prebuilt
2617+
parsers read their data independently of DOM filters.
26122618
"""
26132619

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

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ class ParseParamsPrebuiltParser(TypedDict, total=False):
231231
"tiktok-followers",
232232
"tiktok-following",
233233
"tiktok-user-search",
234+
"yelp-search",
234235
"emails",
235236
"phone-numbers",
236237
"links",
@@ -295,17 +296,19 @@ class ParseParamsPrebuiltParser(TypedDict, total=False):
295296
(/search/user?q={query}) as data.users: id, username, nickname, biography,
296297
avatar_url, sec_uid, follower_count, like_count, and is_verified. The TikTok
297298
parsers accept tiktok.com, www.tiktok.com, and m.tiktok.com URLs but not short
298-
links (vm.tiktok.com, vt.tiktok.com, tiktok.com/t/…). emails accepts any page
299-
and returns its email addresses as data.emails ([{ email }]), read from mailto
300-
links, Cloudflare-protected addresses, and visible text. phone-numbers accepts
301-
any page and returns its valid phone numbers in E.164 as data.phone_numbers ([{
302-
phone }]), read from tel links and visible text; numbers without a country code
303-
are read for the country of the site TLD, defaulting to US. links accepts any
304-
page and returns its unique http(s) links as data.links ([{ url, text }]), with
305-
absolute URLs; text falls back to aria-label or image alt and is null when a
306-
link has none. The emails parser reads the rendered page and respects content
307-
filters; the other prebuilt parsers read their data independently of DOM
308-
filters.
299+
links (vm.tiktok.com, vt.tiktok.com, tiktok.com/t/…). yelp-search accepts Yelp
300+
search URLs with find_desc and find_loc, reads start as the result offset, and
301+
returns up to 20 ranked organic businesses in data.businesses with total and
302+
pagination. emails accepts any page and returns its email addresses as
303+
data.emails ([{ email }]), read from mailto links, Cloudflare-protected
304+
addresses, and visible text. phone-numbers accepts any page and returns its
305+
valid phone numbers in E.164 as data.phone_numbers ([{ phone }]), read from tel
306+
links and visible text; numbers without a country code are read for the country
307+
of the site TLD, defaulting to US. links accepts any page and returns its unique
308+
http(s) links as data.links ([{ url, text }]), with absolute URLs; text falls
309+
back to aria-label or image alt and is null when a link has none. The emails
310+
parser reads the rendered page and respects content filters; the other prebuilt
311+
parsers read their data independently of DOM filters.
309312
"""
310313

311314
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, g2-reviews returns data.reviews for a G2 product, instagram-profile and instagram-post return one record as data, instagram-feed returns data.posts, tiktok-profile and tiktok-video return one record as data, tiktok-feed returns data.videos, tiktok-comments returns data.comments, tiktok-followers, tiktok-following, and tiktok-user-search return data.users, emails, phone-numbers, and links return data.emails, data.phone_numbers, and data.links from the rendered page; the store, Maps, G2, Instagram, and TikTok 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, instagram-profile and instagram-post return one record as data, instagram-feed returns data.posts, tiktok-profile and tiktok-video return one record as data, tiktok-feed returns data.videos, tiktok-comments returns data.comments, tiktok-followers, tiktok-following, and tiktok-user-search return data.users, yelp-search returns up to 20 ranked organic businesses in data.businesses, plus total and pagination, from a Yelp search URL; emails, phone-numbers, and links return data.emails, data.phone_numbers, and data.links from the rendered page; the store, Maps, G2, Instagram, and TikTok parsers read their data directly, independently of DOM filters and other outputs.
271271
"""
272272

273273
data: Optional[Dict[str, object]] = None
@@ -296,6 +296,7 @@ class Parsed(BaseModel):
296296
"tiktok-followers",
297297
"tiktok-following",
298298
"tiktok-user-search",
299+
"yelp-search",
299300
"emails",
300301
"phone-numbers",
301302
"links",
@@ -491,10 +492,11 @@ class WebScrapeResponse(BaseModel):
491492
data, instagram-feed returns data.posts, tiktok-profile and tiktok-video return
492493
one record as data, tiktok-feed returns data.videos, tiktok-comments returns
493494
data.comments, tiktok-followers, tiktok-following, and tiktok-user-search return
494-
data.users, emails, phone-numbers, and links return data.emails,
495-
data.phone_numbers, and data.links from the rendered page; the store, Maps, G2,
496-
Instagram, and TikTok parsers read their data directly, independently of DOM
497-
filters and other outputs.
495+
data.users, yelp-search returns up to 20 ranked organic businesses in
496+
data.businesses, plus total and pagination, from a Yelp search URL; emails,
497+
phone-numbers, and links return data.emails, data.phone_numbers, and data.links
498+
from the rendered page; the store, Maps, G2, Instagram, and TikTok parsers read
499+
their data directly, independently of DOM filters and other outputs.
498500
"""
499501

500502
product: Product

0 commit comments

Comments
 (0)