From 47a20f09fa8948c4f013d112058884a973ead0a9 Mon Sep 17 00:00:00 2001 From: rmilyushkevich <24544571+rmilyushkevich@users.noreply.github.com> Date: Fri, 2 Oct 2026 07:12:20 +0000 Subject: [PATCH] chore(gen): refresh API specs --- GENERATION_REPORT.md | 31 ++-- cmd/gen_airbnb_listing.go | 10 +- cmd/gen_airbnb_property.go | 4 +- cmd/gen_amazon_product.go | 8 +- cmd/gen_amazon_reviews.go | 6 +- cmd/gen_amazon_search.go | 6 +- cmd/gen_amazon_seller.go | 6 +- cmd/gen_amazon_seller_products.go | 6 +- cmd/gen_booking_place.go | 4 +- cmd/gen_booking_search.go | 4 +- cmd/gen_chat_gpt_chat.go | 60 +++++++ cmd/gen_facebook_profile.go | 73 ++++++++ cmd/gen_glassdoor_job.go | 4 +- cmd/gen_glassdoor_listing.go | 56 ++++++- cmd/gen_google_ai_mode.go | 4 +- cmd/gen_google_events.go | 55 +----- cmd/gen_google_flights.go | 4 +- cmd/gen_google_flights_deals.go | 186 +++++++++++++++++++++ cmd/gen_google_hotels.go | 4 +- cmd/gen_google_images.go | 4 +- cmd/gen_google_immersive_product.go | 4 +- cmd/gen_google_maps.go | 4 +- cmd/gen_google_maps_contributor_reviews.go | 4 +- cmd/gen_google_maps_photos.go | 4 +- cmd/gen_google_maps_place.go | 9 +- cmd/gen_google_maps_posts.go | 5 - cmd/gen_google_maps_reviews.go | 4 +- cmd/gen_google_scholar.go | 143 ++++++++++++++++ cmd/gen_google_scholar_cite.go | 60 +++++++ cmd/gen_google_short_videos.go | 9 +- cmd/gen_google_trends.go | 4 +- cmd/gen_indeed_job.go | 4 +- cmd/gen_indeed_listing.go | 4 +- cmd/gen_instagram_comments.go | 78 +++++++++ cmd/gen_instagram_posts.go | 4 +- cmd/gen_instagram_profile.go | 4 +- cmd/gen_redfin_listing.go | 6 +- cmd/gen_redfin_property.go | 6 +- cmd/gen_shopify_collections.go | 6 +- cmd/gen_shopify_products.go | 6 +- cmd/gen_walmart_product.go | 92 ++++++++++ cmd/gen_walmart_reviews.go | 125 ++++++++++++++ cmd/gen_walmart_search.go | 138 +++++++++++++++ cmd/gen_yellowpages_place.go | 4 +- cmd/gen_yellowpages_search.go | 4 +- cmd/gen_zillow_listing.go | 23 +-- cmd/gen_zillow_property.go | 6 +- internal/gen/spec-hash.txt | 2 +- pr-body.md | 91 ++++++---- 49 files changed, 1191 insertions(+), 197 deletions(-) create mode 100644 cmd/gen_chat_gpt_chat.go create mode 100644 cmd/gen_facebook_profile.go create mode 100644 cmd/gen_google_flights_deals.go create mode 100644 cmd/gen_google_scholar.go create mode 100644 cmd/gen_google_scholar_cite.go create mode 100644 cmd/gen_instagram_comments.go create mode 100644 cmd/gen_walmart_product.go create mode 100644 cmd/gen_walmart_reviews.go create mode 100644 cmd/gen_walmart_search.go diff --git a/GENERATION_REPORT.md b/GENERATION_REPORT.md index 231c296..afc7698 100644 --- a/GENERATION_REPORT.md +++ b/GENERATION_REPORT.md @@ -1,15 +1,11 @@ # Generation Report -Generated at: 2026-08-31T07:13:05Z +Generated at: 2026-10-02T07:12:19Z -## APIs generated (55) +## APIs generated (64) +- chat-gpt-chat - airbnb-listing - airbnb-property -- amazon-product -- amazon-reviews -- amazon-search -- amazon-seller -- amazon-seller-products - bing-serp - booking-place - booking-search @@ -19,6 +15,16 @@ Generated at: 2026-08-31T07:13:05Z - yelp-reviews - yelp-search - duckduckgo +- amazon-product +- amazon-reviews +- amazon-search +- amazon-seller +- amazon-seller-products +- shopify-collections +- shopify-products +- walmart-product +- walmart-reviews +- walmart-search - google-images - google-maps - google-maps-contributor-reviews @@ -34,7 +40,10 @@ Generated at: 2026-08-31T07:13:05Z - google-serp-light - google-shopping - google-short-videos +- google-scholar +- google-scholar-cite - google-flights +- google-flights-deals - google-hotels - google-trends - glassdoor-job @@ -43,8 +52,10 @@ Generated at: 2026-08-31T07:13:05Z - indeed-listing - redfin-listing - redfin-property -- shopify-collections -- shopify-products +- zillow-listing +- zillow-property +- facebook-profile +- instagram-comments - instagram-posts - instagram-profile - tiktok-comments @@ -56,8 +67,6 @@ Generated at: 2026-08-31T07:13:05Z - youtube-search-api - youtube-transcript-api - youtube-video-api -- zillow-listing -- zillow-property ## Deprecated APIs (hidden in help) - amazon-reviews diff --git a/cmd/gen_airbnb_listing.go b/cmd/gen_airbnb_listing.go index da4b0d0..57208dd 100644 --- a/cmd/gen_airbnb_listing.go +++ b/cmd/gen_airbnb_listing.go @@ -34,8 +34,8 @@ func newAirbnbListingCmd() *cobra.Command { cmd := &cobra.Command{ Use: "airbnb-listing", - Short: "Airbnb Listing Scraper API (5 credits/call)", - Long: "The Airbnb Listing Scraper API allows users to retrieve listings from Airbnb based on location and check-in/check-out dates.\n\nEndpoint: GET https://api.hasdata.com/scrape/airbnb/listing\nCost: 5 credits per call.", + Short: "Airbnb Listing Scraper API (10 credits/call)", + Long: "The Airbnb Listing Scraper API allows users to retrieve listings from Airbnb based on location and check-in/check-out dates.\n\nEndpoint: GET https://api.hasdata.com/scrape/airbnb/listing\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil @@ -89,12 +89,12 @@ func newAirbnbListingCmd() *cobra.Command { }, } cmd.Flags().IntVar(&p_adultsVar, "adults", 0, "adults Number of Adults: Number of adults.\n") - cmd.Flags().StringVar(&p_checkInVar, "check-in", "2026-01-01", "checkIn Check-in Date: The check-in date for the listings. (required)") + cmd.Flags().StringVar(&p_checkInVar, "check-in", "2026-10-19", "checkIn Check-in Date: The check-in date for the listings. (required)") _ = cmd.MarkFlagRequired("check-in") - cmd.Flags().StringVar(&p_checkOutVar, "check-out", "2026-01-05", "checkOut Check-out Date: The check-out date for the listings.") + cmd.Flags().StringVar(&p_checkOutVar, "check-out", "2026-10-23", "checkOut Check-out Date: The check-out date for the listings.") cmd.Flags().IntVar(&p_childrenVar, "children", 0, "children Number of Children: Number of children.\n") cmd.Flags().IntVar(&p_infantsVar, "infants", 0, "infants Number of Infants: Number of infants.\n") - cmd.Flags().StringVar(&p_locationVar, "location", "", "location Location: The location to search for listings. Required unless a full map bounding box (neLat, neLng, swLat, swLng) is provided.") + cmd.Flags().StringVar(&p_locationVar, "location", "New York", "location Location: The location to search for listings. Required unless a full map bounding box (neLat, neLng, swLat, swLng) is provided.") cmd.Flags().Float64Var(&p_neLatVar, "ne-lat", 40.8, "neLat North-East Latitude: North-east corner latitude of the map bounding box. When all four bounding-box coordinates are provided, listings are searched within the box instead of by location.\n") cmd.Flags().Float64Var(&p_neLngVar, "ne-lng", -73.9, "neLng North-East Longitude: North-east corner longitude of the map bounding box.\n") cmd.Flags().StringVar(&p_nextPageTokenVar, "next-page-token", "", "nextPageToken Next Page Token: The token used to retrieve the next page of results.") diff --git a/cmd/gen_airbnb_property.go b/cmd/gen_airbnb_property.go index 6d2496b..7af868c 100644 --- a/cmd/gen_airbnb_property.go +++ b/cmd/gen_airbnb_property.go @@ -23,8 +23,8 @@ func newAirbnbPropertyCmd() *cobra.Command { cmd := &cobra.Command{ Use: "airbnb-property", - Short: "Airbnb Property Scraper API (5 credits/call)", - Long: "The Airbnb Property Scraper API allows users to retrieve detailed information about a specific Airbnb listing using its URL.\n\nEndpoint: GET https://api.hasdata.com/scrape/airbnb/property\nCost: 5 credits per call.", + Short: "Airbnb Property Scraper API (10 credits/call)", + Long: "The Airbnb Property Scraper API allows users to retrieve detailed information about a specific Airbnb listing using its URL.\n\nEndpoint: GET https://api.hasdata.com/scrape/airbnb/property\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil diff --git a/cmd/gen_amazon_product.go b/cmd/gen_amazon_product.go index 0d6ef85..5c324ed 100644 --- a/cmd/gen_amazon_product.go +++ b/cmd/gen_amazon_product.go @@ -29,8 +29,8 @@ func newAmazonProductCmd() *cobra.Command { cmd := &cobra.Command{ Use: "amazon-product", - Short: "Amazon Product Scraper API (5 credits/call)", - Long: "The Amazon Product Scraper API allows users to get product details from Amazon based on the specified ASIN and domain. This API enables retrieving detailed information about a specific product on Amazon.\n\nEndpoint: GET https://api.hasdata.com/scrape/amazon/product\nCost: 5 credits per call.", + Short: "Amazon Product Scraper API (10 credits/call)", + Long: "The Amazon Product Scraper API allows users to get product details from Amazon based on the specified ASIN and domain. This API enables retrieving detailed information about a specific product on Amazon.\n\nEndpoint: GET https://api.hasdata.com/scrape/amazon/product\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { if c.Flags().Changed("domain") { @@ -89,7 +89,7 @@ func newAmazonProductCmd() *cobra.Command { return []string{"www.amazon.com", "www.amazon.de", "www.amazon.co.uk", "www.amazon.ae", "www.amazon.com.au", "www.amazon.com.be", "www.amazon.com.br", "www.amazon.ca", "www.amazon.eg", "www.amazon.es", "www.amazon.fr", "www.amazon.ie", "www.amazon.in", "www.amazon.it", "www.amazon.co.jp", "www.amazon.com.mx", "www.amazon.nl", "www.amazon.pl", "www.amazon.sa", "www.amazon.se", "www.amazon.sg", "www.amazon.com.tr", "www.amazon.co.za"}, cobra.ShellCompDirectiveNoFileComp }) cmd.Flags().StringVar(&p_languageVar, "language", "", "language Language: Optional Amazon language code. Supported values depend on the selected domain.") - cmd.Flags().BoolVar(&p_otherSellersVar, "other-sellers", true, "otherSellers Other Sellers: If set to true, extracts the other sellers block from the product page.") + cmd.Flags().BoolVar(&p_otherSellersVar, "other-sellers", true, "otherSellers Other Sellers: Also collect the offers of other sellers competing for this item. This takes an extra request to Amazon and costs 5 credits on top of the base. Default is false.") cmd.Flags().BoolVar(&p_otherSellersVarNeg, "no-"+"other-sellers", false, "disable --other-sellers") cmd.Flags().StringVar(&p_shippingLocationVar, "shipping-location", "", "shippingLocation Shipping Location: The two-letter country code to define the country of the delivery address.") @@ -97,5 +97,5 @@ func newAmazonProductCmd() *cobra.Command { } func init() { - RegisterAPICommand("amazon", "Amazon", newAmazonProductCmd()) + RegisterAPICommand("ecommerce", "E-commerce", newAmazonProductCmd()) } diff --git a/cmd/gen_amazon_reviews.go b/cmd/gen_amazon_reviews.go index b966e11..9ba1415 100644 --- a/cmd/gen_amazon_reviews.go +++ b/cmd/gen_amazon_reviews.go @@ -32,8 +32,8 @@ func newAmazonReviewsCmd() *cobra.Command { cmd := &cobra.Command{ Use: "amazon-reviews", - Short: "[deprecated] Amazon Reviews Scraper API (5 credits/call)", - Long: "The Amazon Reviews Scraper API allows users to get product reviews from Amazon based on the specified ASIN and other optional parameters. This API enables retrieving detailed reviews about a specific product on Amazon.\n\nThis API is deprecated — Amazon Reviews API is currently unavailable because Amazon now requires login to access reviews..\n\nEndpoint: GET https://api.hasdata.com/scrape/amazon/reviews\nCost: 5 credits per call.", + Short: "[deprecated] Amazon Reviews Scraper API (10 credits/call)", + Long: "The Amazon Reviews Scraper API allows users to get product reviews from Amazon based on the specified ASIN and other optional parameters. This API enables retrieving detailed reviews about a specific product on Amazon.\n\nThis API is deprecated — Amazon Reviews API is currently unavailable because Amazon now requires login to access reviews..\n\nEndpoint: GET https://api.hasdata.com/scrape/amazon/reviews\nCost: 10 credits per call.", Args: cobra.NoArgs, Hidden: true, PreRunE: func(c *cobra.Command, _ []string) error { @@ -146,5 +146,5 @@ func newAmazonReviewsCmd() *cobra.Command { } func init() { - RegisterAPICommand("amazon", "Amazon", newAmazonReviewsCmd()) + RegisterAPICommand("ecommerce", "E-commerce", newAmazonReviewsCmd()) } diff --git a/cmd/gen_amazon_search.go b/cmd/gen_amazon_search.go index e447b95..15f9d44 100644 --- a/cmd/gen_amazon_search.go +++ b/cmd/gen_amazon_search.go @@ -29,8 +29,8 @@ func newAmazonSearchCmd() *cobra.Command { cmd := &cobra.Command{ Use: "amazon-search", - Short: "Amazon Search Scraper API (5 credits/call)", - Long: "The Amazon Search Scraper API allows users to get search results from Amazon based on the specified query and domain. This API enables searching for products on Amazon.\n\nEndpoint: GET https://api.hasdata.com/scrape/amazon/search\nCost: 5 credits per call.", + Short: "Amazon Search Scraper API (10 credits/call)", + Long: "The Amazon Search Scraper API allows users to get search results from Amazon based on the specified query and domain. This API enables searching for products on Amazon.\n\nEndpoint: GET https://api.hasdata.com/scrape/amazon/search\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { if c.Flags().Changed("domain") { @@ -97,5 +97,5 @@ func newAmazonSearchCmd() *cobra.Command { } func init() { - RegisterAPICommand("amazon", "Amazon", newAmazonSearchCmd()) + RegisterAPICommand("ecommerce", "E-commerce", newAmazonSearchCmd()) } diff --git a/cmd/gen_amazon_seller.go b/cmd/gen_amazon_seller.go index 4404f14..b2e12dd 100644 --- a/cmd/gen_amazon_seller.go +++ b/cmd/gen_amazon_seller.go @@ -25,8 +25,8 @@ func newAmazonSellerCmd() *cobra.Command { cmd := &cobra.Command{ Use: "amazon-seller", - Short: "Amazon Seller Scraper API (5 credits/call)", - Long: "The Amazon Seller Scraper API allows users to retrieve detailed information about a specific Amazon seller using the seller ID, with optional domain and language settings.\n\nEndpoint: GET https://api.hasdata.com/scrape/amazon/seller\nCost: 5 credits per call.", + Short: "Amazon Seller Scraper API (10 credits/call)", + Long: "The Amazon Seller Scraper API allows users to retrieve detailed information about a specific Amazon seller using the seller ID, with optional domain and language settings.\n\nEndpoint: GET https://api.hasdata.com/scrape/amazon/seller\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { if c.Flags().Changed("domain") { @@ -69,5 +69,5 @@ func newAmazonSellerCmd() *cobra.Command { } func init() { - RegisterAPICommand("amazon", "Amazon", newAmazonSellerCmd()) + RegisterAPICommand("ecommerce", "E-commerce", newAmazonSellerCmd()) } diff --git a/cmd/gen_amazon_seller_products.go b/cmd/gen_amazon_seller_products.go index 77941a6..572e26e 100644 --- a/cmd/gen_amazon_seller_products.go +++ b/cmd/gen_amazon_seller_products.go @@ -26,8 +26,8 @@ func newAmazonSellerProductsCmd() *cobra.Command { cmd := &cobra.Command{ Use: "amazon-seller-products", - Short: "Amazon Seller Products Scraper API (5 credits/call)", - Long: "The Amazon Seller Products Scraper API allows users to retrieve products listed by a specific Amazon seller using the seller ID, with optional domain, language, and page settings.\n\nEndpoint: GET https://api.hasdata.com/scrape/amazon/seller-products\nCost: 5 credits per call.", + Short: "Amazon Seller Products Scraper API (10 credits/call)", + Long: "The Amazon Seller Products Scraper API allows users to retrieve products listed by a specific Amazon seller using the seller ID, with optional domain, language, and page settings.\n\nEndpoint: GET https://api.hasdata.com/scrape/amazon/seller-products\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { if c.Flags().Changed("domain") { @@ -74,5 +74,5 @@ func newAmazonSellerProductsCmd() *cobra.Command { } func init() { - RegisterAPICommand("amazon", "Amazon", newAmazonSellerProductsCmd()) + RegisterAPICommand("ecommerce", "E-commerce", newAmazonSellerProductsCmd()) } diff --git a/cmd/gen_booking_place.go b/cmd/gen_booking_place.go index e2be790..e9db78c 100644 --- a/cmd/gen_booking_place.go +++ b/cmd/gen_booking_place.go @@ -68,9 +68,9 @@ func newBookingPlaceCmd() *cobra.Command { } cmd.Flags().IntVar(&p_adultsVar, "adults", 2, "adults Adults: Number of adult guests across all rooms. (required)") _ = cmd.MarkFlagRequired("adults") - cmd.Flags().StringVar(&p_checkInDateVar, "check-in-date", "2026-06-01", "checkInDate Check-in Date: Check-in date in `YYYY-MM-DD` format. Must be in the future and earlier than `checkOutDate`. (required)") + cmd.Flags().StringVar(&p_checkInDateVar, "check-in-date", "2026-10-19", "checkInDate Check-in Date: Check-in date in `YYYY-MM-DD` format. Must be in the future and earlier than `checkOutDate`. (required)") _ = cmd.MarkFlagRequired("check-in-date") - cmd.Flags().StringVar(&p_checkOutDateVar, "check-out-date", "2026-06-05", "checkOutDate Check-out Date: Check-out date in `YYYY-MM-DD` format. Must be later than `checkInDate`. (required)") + cmd.Flags().StringVar(&p_checkOutDateVar, "check-out-date", "2026-10-23", "checkOutDate Check-out Date: Check-out date in `YYYY-MM-DD` format. Must be later than `checkInDate`. (required)") _ = cmd.MarkFlagRequired("check-out-date") cmd.Flags().IntVar(&p_childrenVar, "children", 0, "children Children Count: Number of child guests across all rooms (0–10). Pass `0` if there are no children. (required)") _ = cmd.MarkFlagRequired("children") diff --git a/cmd/gen_booking_search.go b/cmd/gen_booking_search.go index 1945f62..b7c95f7 100644 --- a/cmd/gen_booking_search.go +++ b/cmd/gen_booking_search.go @@ -246,9 +246,9 @@ func newBookingSearchCmd() *cobra.Command { return []string{"twinBeds", "doubleBed"}, cobra.ShellCompDirectiveNoFileComp }) cmd.Flags().IntVar(&p_bedroomsVar, "bedrooms", 0, "bedrooms Bedrooms: Minimum number of bedrooms in the property.") - cmd.Flags().StringVar(&p_checkInDateVar, "check-in-date", "2026-06-01", "checkInDate Check-in Date: Check-in date in `YYYY-MM-DD` format. Must be in the future and earlier than `checkOutDate`. (required)") + cmd.Flags().StringVar(&p_checkInDateVar, "check-in-date", "2026-10-19", "checkInDate Check-in Date: Check-in date in `YYYY-MM-DD` format. Must be in the future and earlier than `checkOutDate`. (required)") _ = cmd.MarkFlagRequired("check-in-date") - cmd.Flags().StringVar(&p_checkOutDateVar, "check-out-date", "2026-06-05", "checkOutDate Check-out Date: Check-out date in `YYYY-MM-DD` format. Must be later than `checkInDate`. (required)") + cmd.Flags().StringVar(&p_checkOutDateVar, "check-out-date", "2026-10-23", "checkOutDate Check-out Date: Check-out date in `YYYY-MM-DD` format. Must be later than `checkInDate`. (required)") _ = cmd.MarkFlagRequired("check-out-date") cmd.Flags().IntVar(&p_childrenVar, "children", 0, "children Children Count: Number of child guests across all rooms (0–10). Pass `0` if there are no children. (required)") _ = cmd.MarkFlagRequired("children") diff --git a/cmd/gen_chat_gpt_chat.go b/cmd/gen_chat_gpt_chat.go new file mode 100644 index 0000000..6be467d --- /dev/null +++ b/cmd/gen_chat_gpt_chat.go @@ -0,0 +1,60 @@ +// Code generated by internal/gen. DO NOT EDIT. + +package cmd + +import ( + "encoding/json" + "fmt" + "net/url" + "strconv" + + "github.com/spf13/cobra" +) + +var ( + _ = json.Marshal + _ = fmt.Sprintf + _ = url.Values{} + _ = strconv.Itoa +) + +func newChatGptChatCmd() *cobra.Command { + var p_promptVar string + var p_timezoneVar string + + cmd := &cobra.Command{ + Use: "chat-gpt-chat", + Short: "ChatGPT Scraper API (10 credits/call)", + Long: "The ChatGPT Scraper API sends a prompt to ChatGPT and returns the answer as text, together with the web sources ChatGPT consulted when it decided to search the web. No OpenAI account or API key is needed.\n\nEndpoint: GET https://api.hasdata.com/scrape/chatgpt/chat\nCost: 10 credits per call.", + Args: cobra.NoArgs, + PreRunE: func(c *cobra.Command, _ []string) error { + return nil + }, + RunE: func(c *cobra.Command, _ []string) error { + ctx := c.Context() + cli, err := Client() + if err != nil { + return err + } + params := url.Values{} + params.Set("prompt", p_promptVar) + if c.Flags().Changed("timezone") { + params.Set("timezone", p_timezoneVar) + } + resp, err := cli.Do(ctx, "GET", "https://api.hasdata.com/scrape/chatgpt/chat", params, nil) + if err != nil { + return err + } + return WriteResponse(c, resp) + }, + } + cmd.Flags().StringVar(&p_promptVar, "prompt", "What are the latest developments in the James Webb Space Telescope this month?", "prompt Prompt: The question or instruction to send to ChatGPT, up to 8000 characters. A prompt that asks about recent events makes ChatGPT search the web and return sources; a general-knowledge prompt is answered from the model alone. The prompt also decides the language of the answer — write it in the language you want back, or ask for one explicitly (\"Antworte auf Deutsch\"). (required)") + _ = cmd.MarkFlagRequired("prompt") + cmd.Flags().StringVar(&p_timezoneVar, "timezone", "Europe/Berlin", "timezone Timezone: IANA time zone name, for example `America/Chicago` or `Europe/Berlin`. It sets what ChatGPT treats as the current date and time, which matters for prompts that say \"today\", \"this week\" or \"latest\".") + + return cmd +} + +func init() { + RegisterAPICommand("ai", "AI", newChatGptChatCmd()) +} diff --git a/cmd/gen_facebook_profile.go b/cmd/gen_facebook_profile.go new file mode 100644 index 0000000..5f58f55 --- /dev/null +++ b/cmd/gen_facebook_profile.go @@ -0,0 +1,73 @@ +// Code generated by internal/gen. DO NOT EDIT. + +package cmd + +import ( + "encoding/json" + "fmt" + "net/url" + "strconv" + + "github.com/spf13/cobra" +) + +var ( + _ = json.Marshal + _ = fmt.Sprintf + _ = url.Values{} + _ = strconv.Itoa +) + +func newFacebookProfileCmd() *cobra.Command { + var p_handleVar string + var p_languageVar string + var p_nextPageTokenVar string + + cmd := &cobra.Command{ + Use: "facebook-profile", + Short: "Facebook Profile Scraper API (10 credits/call)", + Long: "The Facebook Profile Scraper API lets you retrieve public information from a Facebook page or profile by its handle, together with the posts on the page. It returns name, category, bio, exact likes and talking-about counts, followers and following, website, phone, the page owner, profile and cover photos, the photo tiles, and the posts with their text, media, reaction breakdown, comment and share counts.\n\nEndpoint: GET https://api.hasdata.com/scrape/facebook/profile\nCost: 10 credits per call.", + Args: cobra.NoArgs, + PreRunE: func(c *cobra.Command, _ []string) error { + if c.Flags().Changed("language") { + if err := validateEnumString("language", p_languageVar, []string{"ar", "bn", "cs", "da", "de", "el", "en", "es", "fi", "fil", "fr", "he", "hi", "hu", "id", "it", "ja", "ko", "ms", "nb", "nl", "pl", "pt", "ro", "ru", "sv", "th", "tr", "uk", "vi", "zh-hans", "zh-hant"}); err != nil { + return err + } + } + return nil + }, + RunE: func(c *cobra.Command, _ []string) error { + ctx := c.Context() + cli, err := Client() + if err != nil { + return err + } + params := url.Values{} + params.Set("handle", p_handleVar) + if c.Flags().Changed("language") { + params.Set("language", p_languageVar) + } + if c.Flags().Changed("next-page-token") { + params.Set("nextPageToken", p_nextPageTokenVar) + } + resp, err := cli.Do(ctx, "GET", "https://api.hasdata.com/scrape/facebook/profile", params, nil) + if err != nil { + return err + } + return WriteResponse(c, resp) + }, + } + cmd.Flags().StringVar(&p_handleVar, "handle", "nike", "handle Facebook Handle: The Facebook username of the page or profile you want to scrape, with or without the `@` symbol, or its numeric profile id (the `id` of a `profile.php?id=…` URL), e.g. `nike` or `61550916779928`. Groups and private personal accounts are not supported. (required)") + _ = cmd.MarkFlagRequired("handle") + cmd.Flags().StringVar(&p_languageVar, "language", "", "language Language: Language the page is rendered in. Facebook serves a page in the language of the request, so this changes the localised strings (`followersCount`, `followingCount`, `category`) while the exact figures (`likesCount`, `talkingAboutCount`) stay numeric in every language. [allowed: ar|bn|cs|da|de|el|en|es|fi|fil|fr|he|hi|hu|id|it|ja|ko|ms|nb|nl|pl|pt|ro|ru|sv|th|tr|uk|vi|zh-hans|zh-hant]") + _ = cmd.RegisterFlagCompletionFunc("language", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"ar", "bn", "cs", "da", "de", "el", "en", "es", "fi", "fil", "fr", "he", "hi", "hu", "id", "it", "ja", "ko", "ms", "nb", "nl", "pl", "pt", "ro", "ru", "sv", "th", "tr", "uk", "vi", "zh-hans", "zh-hant"}, cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().StringVar(&p_nextPageTokenVar, "next-page-token", "", "nextPageToken Next Page Token: Token from the `pagination.nextPageToken` field of a previous response; the page it leads to is reported as `pagination.nextPage`. Each paginated request returns the next three posts of the feed and a fresh token; the token is absent once the feed ends. Every request is billed separately.") + + return cmd +} + +func init() { + RegisterAPICommand("social", "Social", newFacebookProfileCmd()) +} diff --git a/cmd/gen_glassdoor_job.go b/cmd/gen_glassdoor_job.go index 777e877..28544da 100644 --- a/cmd/gen_glassdoor_job.go +++ b/cmd/gen_glassdoor_job.go @@ -23,8 +23,8 @@ func newGlassdoorJobCmd() *cobra.Command { cmd := &cobra.Command{ Use: "glassdoor-job", - Short: "Glassdoor Job Scraper API (5 credits/call)", - Long: "The Glassdoor Job Scraper API allows you to retrieve detailed information about a specific job listing based on the provided vacancy URL.\n\nEndpoint: GET https://api.hasdata.com/scrape/glassdoor/job\nCost: 5 credits per call.", + Short: "Glassdoor Job Scraper API (10 credits/call)", + Long: "The Glassdoor Job Scraper API allows you to retrieve detailed information about a specific job listing based on the provided vacancy URL.\n\nEndpoint: GET https://api.hasdata.com/scrape/glassdoor/job\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil diff --git a/cmd/gen_glassdoor_listing.go b/cmd/gen_glassdoor_listing.go index fe81cb6..cd1a597 100644 --- a/cmd/gen_glassdoor_listing.go +++ b/cmd/gen_glassdoor_listing.go @@ -19,23 +19,45 @@ var ( ) func newGlassdoorListingCmd() *cobra.Command { + var p_datePostedVar int var p_domainVar string + var p_easyApplyOnlyVar bool var p_keywordVar string var p_locationVar string + var p_maxSalaryVar int + var p_minRatingVar int + var p_minSalaryVar int var p_nextPageTokenVar string + var p_radiusVar int + var p_remoteOnlyVar bool var p_sortVar string cmd := &cobra.Command{ Use: "glassdoor-listing", - Short: "Glassdoor Listing Scraper API (5 credits/call)", - Long: "The Glassdoor Listing Scraper API allows you to retrieve job listings from Glassdoor based on various search parameters.\n\nEndpoint: GET https://api.hasdata.com/scrape/glassdoor/listing\nCost: 5 credits per call.", + Short: "Glassdoor Listing Scraper API (10 credits/call)", + Long: "The Glassdoor Listing Scraper API allows you to retrieve job listings from Glassdoor based on various search parameters.\n\nEndpoint: GET https://api.hasdata.com/scrape/glassdoor/listing\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { + if c.Flags().Changed("date-posted") { + if err := validateEnumInt("date-posted", p_datePostedVar, []int{1, 3, 7, 14, 30}); err != nil { + return err + } + } if c.Flags().Changed("domain") { if err := validateEnumString("domain", p_domainVar, []string{"www.glassdoor.com.ar", "www.glassdoor.com.au", "www.glassdoor.at", "nl.glassdoor.be", "fr.glassdoor.be", "www.glassdoor.com.br", "www.glassdoor.ca", "fr.glassdoor.ca", "www.glassdoor.fr", "www.glassdoor.de", "www.glassdoor.com.hk", "www.glassdoor.co.in", "www.glassdoor.ie", "www.glassdoor.it", "www.glassdoor.com.mx", "www.glassdoor.nl", "www.glassdoor.co.nz", "www.glassdoor.sg", "www.glassdoor.es", "de.glassdoor.ch", "fr.glassdoor.ch", "www.glassdoor.co.uk"}); err != nil { return err } } + if c.Flags().Changed("min-rating") { + if err := validateEnumInt("min-rating", p_minRatingVar, []int{1, 2, 3, 4}); err != nil { + return err + } + } + if c.Flags().Changed("radius") { + if err := validateEnumInt("radius", p_radiusVar, []int{0, 5, 10, 15, 25, 50, 100}); err != nil { + return err + } + } if c.Flags().Changed("sort") { if err := validateEnumString("sort", p_sortVar, []string{"recent", "relevant"}); err != nil { return err @@ -50,14 +72,35 @@ func newGlassdoorListingCmd() *cobra.Command { return err } params := url.Values{} + if c.Flags().Changed("date-posted") { + params.Set("datePosted", strconv.Itoa(p_datePostedVar)) + } if c.Flags().Changed("domain") { params.Set("domain", p_domainVar) } + if c.Flags().Changed("easy-apply-only") { + params.Set("easyApplyOnly", strconv.FormatBool(p_easyApplyOnlyVar)) + } params.Set("keyword", p_keywordVar) params.Set("location", p_locationVar) + if c.Flags().Changed("max-salary") { + params.Set("maxSalary", strconv.Itoa(p_maxSalaryVar)) + } + if c.Flags().Changed("min-rating") { + params.Set("minRating", strconv.Itoa(p_minRatingVar)) + } + if c.Flags().Changed("min-salary") { + params.Set("minSalary", strconv.Itoa(p_minSalaryVar)) + } if c.Flags().Changed("next-page-token") { params.Set("nextPageToken", p_nextPageTokenVar) } + if c.Flags().Changed("radius") { + params.Set("radius", strconv.Itoa(p_radiusVar)) + } + if c.Flags().Changed("remote-only") { + params.Set("remoteOnly", strconv.FormatBool(p_remoteOnlyVar)) + } if c.Flags().Changed("sort") { params.Set("sort", p_sortVar) } @@ -68,15 +111,22 @@ func newGlassdoorListingCmd() *cobra.Command { return WriteResponse(c, resp) }, } + cmd.Flags().IntVar(&p_datePostedVar, "date-posted", 7, "datePosted Date Posted: Returns only jobs posted within the given number of days. [allowed: 1, 3, 7, 14, 30]") cmd.Flags().StringVar(&p_domainVar, "domain", "www.glassdoor.com", "domain: The domain of the Glassdoor site (optional). [allowed: www.glassdoor.com.ar|www.glassdoor.com.au|www.glassdoor.at|nl.glassdoor.be|fr.glassdoor.be|www.glassdoor.com.br|www.glassdoor.ca|fr.glassdoor.ca|www.glassdoor.fr|www.glassdoor.de|www.glassdoor.com.hk|www.glassdoor.co.in|www.glassdoor.ie|www.glassdoor.it|www.glassdoor.com.mx|www.glassdoor.nl|www.glassdoor.co.nz|www.glassdoor.sg|www.glassdoor.es|de.glassdoor.ch|fr.glassdoor.ch|www.glassdoor.co.uk]") _ = cmd.RegisterFlagCompletionFunc("domain", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { return []string{"www.glassdoor.com.ar", "www.glassdoor.com.au", "www.glassdoor.at", "nl.glassdoor.be", "fr.glassdoor.be", "www.glassdoor.com.br", "www.glassdoor.ca", "fr.glassdoor.ca", "www.glassdoor.fr", "www.glassdoor.de", "www.glassdoor.com.hk", "www.glassdoor.co.in", "www.glassdoor.ie", "www.glassdoor.it", "www.glassdoor.com.mx", "www.glassdoor.nl", "www.glassdoor.co.nz", "www.glassdoor.sg", "www.glassdoor.es", "de.glassdoor.ch", "fr.glassdoor.ch", "www.glassdoor.co.uk"}, cobra.ShellCompDirectiveNoFileComp }) + cmd.Flags().BoolVar(&p_easyApplyOnlyVar, "easy-apply-only", false, "easyApplyOnly Easy Apply Only: Returns only jobs that can be applied to directly on Glassdoor. Defaults to false.") cmd.Flags().StringVar(&p_keywordVar, "keyword", "software engineer", "keyword Search Query: The keyword used to search for job listings. (required)") _ = cmd.MarkFlagRequired("keyword") cmd.Flags().StringVar(&p_locationVar, "location", "New York, NY", "location Location: The location to search for job listings. (required)") _ = cmd.MarkFlagRequired("location") - cmd.Flags().StringVar(&p_nextPageTokenVar, "next-page-token", "", "nextPageToken Next Page Token: Token for fetching the next page of jobs.") + cmd.Flags().IntVar(&p_maxSalaryVar, "max-salary", 150000, "maxSalary Maximum Salary: Upper bound of the yearly pay range, must be greater than `minSalary`. Can be used on its own.") + cmd.Flags().IntVar(&p_minRatingVar, "min-rating", 4, "minRating Company Rating: Returns jobs from companies rated at least this high. Glassdoor applies the filter approximately, so a few companies rated slightly below the value can appear. [allowed: 1, 2, 3, 4]") + cmd.Flags().IntVar(&p_minSalaryVar, "min-salary", 90000, "minSalary Minimum Salary: Lower bound of the yearly pay range. A job is kept when its estimated pay range overlaps the requested one; hourly and monthly pay are converted to yearly. Jobs without a pay estimate are excluded when a salary filter is set.") + cmd.Flags().StringVar(&p_nextPageTokenVar, "next-page-token", "", "nextPageToken Next Page Token: Token for fetching the next page of jobs, taken from the pagination of a previous response. The token keeps the filters of the search it came from, so they do not need to be sent again.") + cmd.Flags().IntVar(&p_radiusVar, "radius", 25, "radius Distance: Search radius around the location, in miles. `0` keeps only jobs in the location itself. Glassdoor uses 25 miles when this is not set. [allowed: 0, 5, 10, 15, 25, 50, 100]") + cmd.Flags().BoolVar(&p_remoteOnlyVar, "remote-only", false, "remoteOnly Remote Only: Returns only remote jobs. Defaults to false.") cmd.Flags().StringVar(&p_sortVar, "sort", "recent", "sort Sort By: The sorting option for the search results. [allowed: recent|relevant]") _ = cmd.RegisterFlagCompletionFunc("sort", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { return []string{"recent", "relevant"}, cobra.ShellCompDirectiveNoFileComp diff --git a/cmd/gen_google_ai_mode.go b/cmd/gen_google_ai_mode.go index 87122cc..89b1573 100644 --- a/cmd/gen_google_ai_mode.go +++ b/cmd/gen_google_ai_mode.go @@ -29,8 +29,8 @@ func newGoogleAiModeCmd() *cobra.Command { cmd := &cobra.Command{ Use: "google-ai-mode", - Short: "Google AI Mode SERP API (5 credits/call)", - Long: "The Google AI Mode SERP API captures Gemini-powered AI responses from Google Search. Get structured, conversational answers with links, summaries, and subtopic breakdowns—ideal for next-gen search and content tools.\n\nEndpoint: GET https://api.hasdata.com/scrape/google/ai-mode\nCost: 5 credits per call.", + Short: "Google AI Mode SERP API (10 credits/call)", + Long: "The Google AI Mode SERP API captures Gemini-powered AI responses from Google Search. Get structured, conversational answers with links, summaries, and subtopic breakdowns—ideal for next-gen search and content tools.\n\nEndpoint: GET https://api.hasdata.com/scrape/google/ai-mode\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil diff --git a/cmd/gen_google_events.go b/cmd/gen_google_events.go index 35d7a50..93ccffa 100644 --- a/cmd/gen_google_events.go +++ b/cmd/gen_google_events.go @@ -19,26 +19,14 @@ var ( ) func newGoogleEventsCmd() *cobra.Command { - var p_domainVar string - var p_glVar string - var p_hlVar string - var p_htichipsVar string - var p_locationVar string - var p_qVar string - var p_startVar int - var p_uuleVar string + var p_pageTokenVar string cmd := &cobra.Command{ Use: "google-events", - Short: "Google Events API (5 credits/call)", - Long: "The Google Events API allows users to retrieve information about events based on specified search terms, locations, and various filter options.\n\nEndpoint: GET https://api.hasdata.com/scrape/google/events\nCost: 5 credits per call.", + Short: "Google Events API (10 credits/call)", + Long: "The Google Events API retrieves full details for a single Google event — venue, ticket sources, ratings, and description — given the `pageToken` of an event returned by the Google Search API.\n\nEndpoint: GET https://api.hasdata.com/scrape/google/events\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { - if c.Flags().Changed("domain") { - if err := validateEnumString("domain", p_domainVar, []string{"google.ac", "google.ad", "google.ae", "google.al", "google.am", "google.as", "google.at", "google.az", "google.ba", "google.be", "google.bf", "google.bg", "google.bi", "google.bj", "google.bs", "google.bt", "google.by", "google.ca", "google.cd", "google.cf", "google.cg", "google.ch", "google.ci", "google.cl", "google.cm", "google.co.ao", "google.co.bw", "google.co.ck", "google.co.cr", "google.co.id", "google.co.il", "google.co.in", "google.co.jp", "google.co.ke", "google.co.kr", "google.co.ls", "google.co.ma", "google.co.mz", "google.co.nz", "google.co.th", "google.co.tz", "google.co.ug", "google.co.uk", "google.co.uz", "google.co.ve", "google.co.vi", "google.co.za", "google.co.zm", "google.co.zw", "google.com", "google.com.af", "google.com.ag", "google.com.ai", "google.com.ar", "google.com.au", "google.com.bd", "google.com.bh", "google.com.bn", "google.com.bo", "google.com.br", "google.com.bz", "google.com.co", "google.com.cu", "google.com.cy", "google.com.do", "google.com.ec", "google.com.eg", "google.com.et", "google.com.fj", "google.com.gh", "google.com.gi", "google.com.gt", "google.com.hk", "google.com.jm", "google.com.kh", "google.com.kw", "google.com.lb", "google.com.ly", "google.com.mm", "google.com.mt", "google.com.mx", "google.com.my", "google.com.na", "google.com.ng", "google.ng", "google.com.nf", "google.com.ni", "google.com.np", "google.com.om", "google.com.pa", "google.com.pe", "google.com.pg", "google.com.ph", "google.com.pk", "google.com.pr", "google.com.py", "google.com.qa", "google.com.sa", "google.com.sb", "google.com.sg", "google.com.sl", "google.com.sv", "google.com.tj", "google.com.tr", "google.com.tw", "google.com.ua", "google.com.uy", "google.com.vc", "google.com.vn", "google.cat", "google.cn", "google.cv", "google.cz", "google.de", "google.dj", "google.dk", "google.dm", "google.dz", "google.ee", "google.es", "google.fi", "google.fm", "google.fr", "google.ga", "google.ge", "google.gg", "google.gl", "google.gm", "google.gp", "google.gr", "google.gy", "google.hn", "google.hr", "google.ht", "google.hu", "google.ie", "google.im", "google.iq", "google.is", "google.it", "google.je", "google.jo", "google.kg", "google.ki", "google.kz", "google.la", "google.li", "google.lk", "google.lt", "google.lu", "google.lv", "google.md", "google.me", "google.mg", "google.mk", "google.ml", "google.mn", "google.ms", "google.mu", "google.mv", "google.mw", "google.ne", "google.nl", "google.no", "google.nr", "google.nu", "google.pl", "google.pn", "google.ps", "google.pt", "google.ro", "google.rs", "google.ru", "google.rw", "google.sc", "google.se", "google.sh", "google.si", "google.sk", "google.sm", "google.sn", "google.so", "google.sr", "google.st", "google.td", "google.tg", "google.tk", "google.tl", "google.tm", "google.tn", "google.to", "google.tt", "google.vg", "google.vu", "google.ws"}); err != nil { - return err - } - } return nil }, RunE: func(c *cobra.Command, _ []string) error { @@ -48,28 +36,7 @@ func newGoogleEventsCmd() *cobra.Command { return err } params := url.Values{} - if c.Flags().Changed("domain") { - params.Set("domain", p_domainVar) - } - if c.Flags().Changed("gl") { - params.Set("gl", p_glVar) - } - if c.Flags().Changed("hl") { - params.Set("hl", p_hlVar) - } - if c.Flags().Changed("htichips") { - params.Set("htichips", p_htichipsVar) - } - if c.Flags().Changed("location") { - params.Set("location", p_locationVar) - } - params.Set("q", p_qVar) - if c.Flags().Changed("start") { - params.Set("start", strconv.Itoa(p_startVar)) - } - if c.Flags().Changed("uule") { - params.Set("uule", p_uuleVar) - } + params.Set("pageToken", p_pageTokenVar) resp, err := cli.Do(ctx, "GET", "https://api.hasdata.com/scrape/google/events", params, nil) if err != nil { return err @@ -77,18 +44,8 @@ func newGoogleEventsCmd() *cobra.Command { return WriteResponse(c, resp) }, } - cmd.Flags().StringVar(&p_domainVar, "domain", "", "domain Domain: Google domain to use. Default is google.com. [allowed: google.ac|google.ad|google.ae|google.al|google.am|google.as|google.at|google.az|google.ba|google.be|google.bf|google.bg|google.bi|google.bj|google.bs|google.bt|google.by|google.ca|google.cd|google.cf|google.cg|google.ch|google.ci|google.cl|google.cm|google.co.ao|google.co.bw|google.co.ck|google.co.cr|google.co.id|google.co.il|google.co.in|google.co.jp|google.co.ke|google.co.kr|google.co.ls|google.co.ma|google.co.mz|google.co.nz|google.co.th|google.co.tz|google.co.ug|google.co.uk|google.co.uz|google.co.ve|google.co.vi|google.co.za|google.co.zm|google.co.zw|google.com|google.com.af|google.com.ag|google.com.ai|google.com.ar|google.com.au|google.com.bd|google.com.bh|google.com.bn|google.com.bo|google.com.br|google.com.bz|google.com.co|google.com.cu|google.com.cy|google.com.do|google.com.ec|google.com.eg|google.com.et|google.com.fj|google.com.gh|google.com.gi|google.com.gt|google.com.hk|google.com.jm|google.com.kh|google.com.kw|google.com.lb|google.com.ly|google.com.mm|google.com.mt|google.com.mx|google.com.my|google.com.na|google.com.ng|google.ng|google.com.nf|google.com.ni|google.com.np|google.com.om|google.com.pa|google.com.pe|google.com.pg|google.com.ph|google.com.pk|google.com.pr|google.com.py|google.com.qa|google.com.sa|google.com.sb|google.com.sg|google.com.sl|google.com.sv|google.com.tj|google.com.tr|google.com.tw|google.com.ua|google.com.uy|google.com.vc|google.com.vn|google.cat|google.cn|google.cv|google.cz|google.de|google.dj|google.dk|google.dm|google.dz|google.ee|google.es|google.fi|google.fm|google.fr|google.ga|google.ge|google.gg|google.gl|google.gm|google.gp|google.gr|google.gy|google.hn|google.hr|google.ht|google.hu|google.ie|google.im|google.iq|google.is|google.it|google.je|google.jo|google.kg|google.ki|google.kz|google.la|google.li|google.lk|google.lt|google.lu|google.lv|google.md|google.me|google.mg|google.mk|google.ml|google.mn|google.ms|google.mu|google.mv|google.mw|google.ne|google.nl|google.no|google.nr|google.nu|google.pl|google.pn|google.ps|google.pt|google.ro|google.rs|google.ru|google.rw|google.sc|google.se|google.sh|google.si|google.sk|google.sm|google.sn|google.so|google.sr|google.st|google.td|google.tg|google.tk|google.tl|google.tm|google.tn|google.to|google.tt|google.vg|google.vu|google.ws]") - _ = cmd.RegisterFlagCompletionFunc("domain", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { - return []string{"google.ac", "google.ad", "google.ae", "google.al", "google.am", "google.as", "google.at", "google.az", "google.ba", "google.be", "google.bf", "google.bg", "google.bi", "google.bj", "google.bs", "google.bt", "google.by", "google.ca", "google.cd", "google.cf", "google.cg", "google.ch", "google.ci", "google.cl", "google.cm", "google.co.ao", "google.co.bw", "google.co.ck", "google.co.cr", "google.co.id", "google.co.il", "google.co.in", "google.co.jp", "google.co.ke", "google.co.kr", "google.co.ls", "google.co.ma", "google.co.mz", "google.co.nz", "google.co.th", "google.co.tz", "google.co.ug", "google.co.uk", "google.co.uz", "google.co.ve", "google.co.vi", "google.co.za", "google.co.zm", "google.co.zw", "google.com", "google.com.af", "google.com.ag", "google.com.ai", "google.com.ar", "google.com.au", "google.com.bd", "google.com.bh", "google.com.bn", "google.com.bo", "google.com.br", "google.com.bz", "google.com.co", "google.com.cu", "google.com.cy", "google.com.do", "google.com.ec", "google.com.eg", "google.com.et", "google.com.fj", "google.com.gh", "google.com.gi", "google.com.gt", "google.com.hk", "google.com.jm", "google.com.kh", "google.com.kw", "google.com.lb", "google.com.ly", "google.com.mm", "google.com.mt", "google.com.mx", "google.com.my", "google.com.na", "google.com.ng", "google.ng", "google.com.nf", "google.com.ni", "google.com.np", "google.com.om", "google.com.pa", "google.com.pe", "google.com.pg", "google.com.ph", "google.com.pk", "google.com.pr", "google.com.py", "google.com.qa", "google.com.sa", "google.com.sb", "google.com.sg", "google.com.sl", "google.com.sv", "google.com.tj", "google.com.tr", "google.com.tw", "google.com.ua", "google.com.uy", "google.com.vc", "google.com.vn", "google.cat", "google.cn", "google.cv", "google.cz", "google.de", "google.dj", "google.dk", "google.dm", "google.dz", "google.ee", "google.es", "google.fi", "google.fm", "google.fr", "google.ga", "google.ge", "google.gg", "google.gl", "google.gm", "google.gp", "google.gr", "google.gy", "google.hn", "google.hr", "google.ht", "google.hu", "google.ie", "google.im", "google.iq", "google.is", "google.it", "google.je", "google.jo", "google.kg", "google.ki", "google.kz", "google.la", "google.li", "google.lk", "google.lt", "google.lu", "google.lv", "google.md", "google.me", "google.mg", "google.mk", "google.ml", "google.mn", "google.ms", "google.mu", "google.mv", "google.mw", "google.ne", "google.nl", "google.no", "google.nr", "google.nu", "google.pl", "google.pn", "google.ps", "google.pt", "google.ro", "google.rs", "google.ru", "google.rw", "google.sc", "google.se", "google.sh", "google.si", "google.sk", "google.sm", "google.sn", "google.so", "google.sr", "google.st", "google.td", "google.tg", "google.tk", "google.tl", "google.tm", "google.tn", "google.to", "google.tt", "google.vg", "google.vu", "google.ws"}, cobra.ShellCompDirectiveNoFileComp - }) - cmd.Flags().StringVar(&p_glVar, "gl", "", "gl Country: The two-letter country code for the country you want to limit the search to.") - cmd.Flags().StringVar(&p_hlVar, "hl", "", "hl Language: The two-letter language code for the language you want to use for the search.") - cmd.Flags().StringVar(&p_htichipsVar, "htichips", "", "htichips Filtering: Filter parameter for refining event search results. Supports various filters for events. Multiple filters can be passed using a comma. The available filters are:\n\n- `date:today`: Today's Events\n- `date:tomorrow`: Tomorrow's Events\n- `date:week`: This Week's Events\n- `date:weekend`: This Weekend's Events\n- `date:next_week`: Next Week's Events\n- `date:month`: This Month's Events\n- `date:next_month`: Next Month's Events\n- `event_type:Virtual-Event`: Online Events\n\nFor example, to filter for today's online events, use: `event_type:Virtual-Event,date:today`.\n") - cmd.Flags().StringVar(&p_locationVar, "location", "Austin,Texas,United States", "location Location: Google canonical location for the search.") - cmd.Flags().StringVar(&p_qVar, "q", "Events in New York", "q Search Query: Specify the search term for which you want to scrape the SERP. (required)") - _ = cmd.MarkFlagRequired("q") - cmd.Flags().IntVar(&p_startVar, "start", 0, "start Result Offset: This parameter specifies the number of search results to skip and is used for implementing pagination. For example, a value of 0 (default) indicates the first page of results, 10 refers to the second page, and 20 to the third page.\n") - cmd.Flags().StringVar(&p_uuleVar, "uule", "", "uule Encoded Location: The encoded location parameter.") + cmd.Flags().StringVar(&p_pageTokenVar, "page-token", "", "pageToken Page Token: Token identifying a single event, taken from the `pageToken` field of an `eventsResults` entry in a `google/serp` response. Expires a few minutes after it is minted. (required)") + _ = cmd.MarkFlagRequired("page-token") return cmd } diff --git a/cmd/gen_google_flights.go b/cmd/gen_google_flights.go index d10acb8..27b7dfd 100644 --- a/cmd/gen_google_flights.go +++ b/cmd/gen_google_flights.go @@ -204,10 +204,10 @@ func newGoogleFlightsCmd() *cobra.Command { cmd.Flags().IntVar(&p_maxDurationVar, "max-duration", 0, "maxDuration Maximum Flight Duration: The maximum total flight duration in minutes.\n") cmd.Flags().Float64Var(&p_maxPriceVar, "max-price", 0, "maxPrice Maximum Price: Maximum price limit for the flight search, in the selected currency.\n") cmd.Flags().StringVar(&p_multiCityJsonVar, "multi-city-json", "", "multiCityJson Multi-city JSON: This parameter specifies flight details for multi-city trips. It is a JSON string containing multiple flight objects. Each object must include the following fields:\n\n- **departureId** – The departure airport code or location KGMID. Uses the same format as the main `departureId` parameter.\n- **arrivalId** – The arrival airport code or location KGMID. Uses the same format as the main `arrivalId` parameter.\n- **date** – The flight date. Uses the same format as the `outboundDate` parameter.\n- **times** *(optional)* – The time range for the flight. Uses the same format as the `outboundTimes` parameter.\n") - cmd.Flags().StringVar(&p_outboundDateVar, "outbound-date", "2026-08-15", "outboundDate Outbound Date: The outbound travel date in 'yyyy-MM-dd' format.\n (required)") + cmd.Flags().StringVar(&p_outboundDateVar, "outbound-date", "2026-10-19", "outboundDate Outbound Date: The outbound travel date in 'yyyy-MM-dd' format.\n (required)") _ = cmd.MarkFlagRequired("outbound-date") cmd.Flags().StringVar(&p_outboundTimesVar, "outbound-times", "", "outboundTimes Outbound Times: Set up to 4 time boundaries (2 for departure, 2 for arrival) to filter flights. Each number represents the start of an hour.\n\nExamples:\n - `6,20` → 6:00 AM - 9:00 PM departure\n - `1,15` → 1:00 AM - 4:00 PM departure\n - `7,18,2,21` → 7:00 AM - 9:00 PM departure, 2:00 AM - 10:00 PM arrival\n") - cmd.Flags().StringVar(&p_returnDateVar, "return-date", "2026-08-20", "returnDate Return Date: The return travel date in 'yyyy-MM-dd' format. Required when **type** is `roundTrip`.\n") + cmd.Flags().StringVar(&p_returnDateVar, "return-date", "2026-10-26", "returnDate Return Date: The return travel date in 'yyyy-MM-dd' format. Required when **type** is `roundTrip`.\n") cmd.Flags().StringVar(&p_returnTimesVar, "return-times", "", "returnTimes Return Times: Set up to 4 time boundaries (2 for departure, 2 for arrival) to filter return flights. Each number represents the start of an hour.\n\nExamples:\n - `6,20` → 6:00 AM - 9:00 PM departure\n - `1,15` → 1:00 AM - 4:00 PM departure\n - `7,18,2,21` → 7:00 AM - 9:00 PM departure, 2:00 AM - 10:00 PM arrival\n") cmd.Flags().BoolVar(&p_showHiddenVar, "show-hidden", false, "showHidden Show Hidden Fares: Indicates whether to include hidden options in the results.\n") cmd.Flags().StringVar(&p_sortByVar, "sort-by", "", "sortBy Sort By: Sort the flight results based on price, departure time, arrival time, etc.\n [allowed: topFlights|price|departureTime|arrivalTime|duration|emissions]") diff --git a/cmd/gen_google_flights_deals.go b/cmd/gen_google_flights_deals.go new file mode 100644 index 0000000..dc14db0 --- /dev/null +++ b/cmd/gen_google_flights_deals.go @@ -0,0 +1,186 @@ +// Code generated by internal/gen. DO NOT EDIT. + +package cmd + +import ( + "encoding/json" + "fmt" + "net/url" + "strconv" + + "github.com/spf13/cobra" +) + +var ( + _ = json.Marshal + _ = fmt.Sprintf + _ = url.Values{} + _ = strconv.Itoa +) + +func newGoogleFlightsDealsCmd() *cobra.Command { + var p_adultsVar int + var p_arrivalIdVar string + var p_childrenVar int + var p_currencyVar string + var p_departureIdVar string + var p_excludeAirlinesVar string + var p_glVar string + var p_hlVar string + var p_includeAirlinesVar string + var p_infantsInSeatVar int + var p_infantsOnLapVar int + var p_maxDurationVar int + var p_maxPriceVar int + var p_outboundDateVar string + var p_qVar string + var p_returnDateVar string + var p_stopsVar string + var p_travelClassVar string + var p_travelDurationVar string + var p_tripLengthVar string + var p_typeVar string + + cmd := &cobra.Command{ + Use: "google-flights-deals", + Short: "Google Flights Deals API (15 credits/call)", + Long: "The Google Flights Deals API turns a plain-language trip description into concrete flight deals, letting Google's AI work out the destinations and travel dates on its own.\n\nEndpoint: GET https://api.hasdata.com/scrape/google/flights-deals\nCost: 15 credits per call.", + Args: cobra.NoArgs, + PreRunE: func(c *cobra.Command, _ []string) error { + if c.Flags().Changed("stops") { + if err := validateEnumString("stops", p_stopsVar, []string{"1", "nonStop", "2", "oneStopOrFewer", "3", "twoStopsOrFewer"}); err != nil { + return err + } + } + if c.Flags().Changed("travel-class") { + if err := validateEnumString("travel-class", p_travelClassVar, []string{"1", "economy", "2", "premiumEconomy", "3", "business", "4", "first"}); err != nil { + return err + } + } + if c.Flags().Changed("travel-duration") { + if err := validateEnumString("travel-duration", p_travelDurationVar, []string{"1", "week", "2", "weekend", "3", "twoWeeks"}); err != nil { + return err + } + } + if c.Flags().Changed("type") { + if err := validateEnumString("type", p_typeVar, []string{"1", "roundTrip", "2", "oneWay"}); err != nil { + return err + } + } + return nil + }, + RunE: func(c *cobra.Command, _ []string) error { + ctx := c.Context() + cli, err := Client() + if err != nil { + return err + } + params := url.Values{} + if c.Flags().Changed("adults") { + params.Set("adults", strconv.Itoa(p_adultsVar)) + } + if c.Flags().Changed("arrival-id") { + params.Set("arrivalId", p_arrivalIdVar) + } + if c.Flags().Changed("children") { + params.Set("children", strconv.Itoa(p_childrenVar)) + } + if c.Flags().Changed("currency") { + params.Set("currency", p_currencyVar) + } + params.Set("departureId", p_departureIdVar) + if c.Flags().Changed("exclude-airlines") { + params.Set("excludeAirlines", p_excludeAirlinesVar) + } + if c.Flags().Changed("gl") { + params.Set("gl", p_glVar) + } + if c.Flags().Changed("hl") { + params.Set("hl", p_hlVar) + } + if c.Flags().Changed("include-airlines") { + params.Set("includeAirlines", p_includeAirlinesVar) + } + if c.Flags().Changed("infants-in-seat") { + params.Set("infantsInSeat", strconv.Itoa(p_infantsInSeatVar)) + } + if c.Flags().Changed("infants-on-lap") { + params.Set("infantsOnLap", strconv.Itoa(p_infantsOnLapVar)) + } + if c.Flags().Changed("max-duration") { + params.Set("maxDuration", strconv.Itoa(p_maxDurationVar)) + } + if c.Flags().Changed("max-price") { + params.Set("maxPrice", strconv.Itoa(p_maxPriceVar)) + } + if c.Flags().Changed("outbound-date") { + params.Set("outboundDate", p_outboundDateVar) + } + params.Set("q", p_qVar) + if c.Flags().Changed("return-date") { + params.Set("returnDate", p_returnDateVar) + } + if c.Flags().Changed("stops") { + params.Set("stops", p_stopsVar) + } + if c.Flags().Changed("travel-class") { + params.Set("travelClass", p_travelClassVar) + } + if c.Flags().Changed("travel-duration") { + params.Set("travelDuration", p_travelDurationVar) + } + if c.Flags().Changed("trip-length") { + params.Set("tripLength", p_tripLengthVar) + } + if c.Flags().Changed("type") { + params.Set("type", p_typeVar) + } + resp, err := cli.Do(ctx, "GET", "https://api.hasdata.com/scrape/google/flights-deals", params, nil) + if err != nil { + return err + } + return WriteResponse(c, resp) + }, + } + cmd.Flags().IntVar(&p_adultsVar, "adults", 0, "adults Adults: Number of adults. Prices cover the whole party, so raising this raises every deal price.\n\nPassenger counts reprice rather than narrow the search, so they need no `arrivalId`. The whole party must not exceed 9.\n") + cmd.Flags().StringVar(&p_arrivalIdVar, "arrival-id", "", "arrivalId Arrival airport code / location kgmid: Pins the search to one destination instead of letting Google pick from the query.\n\n - **IATA code**: 3 uppercase letters, e.g. `NRT` for Tokyo Narita.\n - **Location kgmid**: starts with `/m/`, found in Wikidata under \"Freebase ID\", e.g. `/m/07dfk` for Tokyo.\n\nRequired by every filter: `type`, `travelClass`, `stops`, `outboundDate`, `returnDate`, `travelDuration`, `tripLength`, `maxPrice`, `maxDuration`, `includeAirlines` and `excludeAirlines`. Without it Google drops them silently.\n") + cmd.Flags().IntVar(&p_childrenVar, "children", 0, "children Children: Number of children, priced at their own fare. Counts towards the limit of 9 passengers.\n") + cmd.Flags().StringVar(&p_currencyVar, "currency", "", "currency Currency: Parameter defines the currency of the returned prices") + cmd.Flags().StringVar(&p_departureIdVar, "departure-id", "LAX", "departureId Departure airport code: Departure airport as a 3-letter uppercase IATA code, e.g. `LAX` or `LHR`. Search on [IATA](https://www.iata.org/en/publications/directories/code-search).\n\nOne airport per search; city names are not accepted.\n (required)") + _ = cmd.MarkFlagRequired("departure-id") + cmd.Flags().StringVar(&p_excludeAirlinesVar, "exclude-airlines", "", "excludeAirlines Exclude airlines: Drops these airlines from the deals. Requires `arrivalId`. Cannot be combined with `includeAirlines`.\n\nTakes the same values as `includeAirlines`.\n") + cmd.Flags().StringVar(&p_glVar, "gl", "", "gl Country: The two-letter country code for the country you want to limit the search to.") + cmd.Flags().StringVar(&p_hlVar, "hl", "", "hl Language: The two-letter language code for the language you want to use for the search.") + cmd.Flags().StringVar(&p_includeAirlinesVar, "include-airlines", "", "includeAirlines Include airlines: Keeps only these airlines. Requires `arrivalId`. Cannot be combined with `excludeAirlines`.\n\nComma-separated 2-character IATA codes (`AF`, `UA`, `B6`) and Google's alliances `STAR_ALLIANCE`, `SKYTEAM`, `ONEWORLD`. The two can be mixed.\n\nAn airline that does not serve the route returns an empty `flightDeals` array, not an error.\n") + cmd.Flags().IntVar(&p_infantsInSeatVar, "infants-in-seat", 0, "infantsInSeat Infants in seat: Number of infants in their own seat. Counts towards the limit of 9 passengers.\n") + cmd.Flags().IntVar(&p_infantsOnLapVar, "infants-on-lap", 0, "infantsOnLap Infants on lap: Number of infants on an adult's lap. Counts towards the limit of 9 passengers.\n\nGoogle prices a lap infant above one in its own seat — the opposite of how airlines usually charge.\n") + cmd.Flags().IntVar(&p_maxDurationVar, "max-duration", 0, "maxDuration Maximum flight duration: Maximum flight duration in minutes — `1500` for 25 hours. Requires `arrivalId`. Omitted, it is unbounded. Applies to each leg, not to the round trip.\n\nGoogle measures against a longer figure than the `durationMinutes` it returns, so set the ceiling above the flight you want: on a route whose shortest deal is 635 minutes, `635` comes back empty and `680` returns it. On an empty result, raise `maxDuration` by up to 200 before concluding the route has nothing.\n") + cmd.Flags().IntVar(&p_maxPriceVar, "max-price", 0, "maxPrice Maximum price: Maximum ticket price, inclusive. Requires `arrivalId`. Omitted, it is unbounded.\n\nRead in the currency of the request: `650` means 650 EUR when `currency` is `EUR`, and 650 USD by default.\n") + cmd.Flags().StringVar(&p_outboundDateVar, "outbound-date", "", "outboundDate Departure date or window: When to depart. Requires `arrivalId`.\n\n - **Exact date**: `2026-12-10`\n - **Window**: `2026-12-01,2026-12-10` — any day within it\n\nOmitted, Google picks the dates from the query, or from whatever is cheapest.\n") + cmd.Flags().StringVar(&p_qVar, "q", "I would like to see cherry blossom in Japan", "q Trip description: Free-text trip description, from a bare place name to a full sentence:\n\n - **Destination**: `Tokyo`\n - **Type of trip**: `beach escape`, `weekend getaway in Europe`\n - **Season or event**: `I would like to see cherry blossom in Japan`\n\nWhen the query implies a time of year, Google dates it itself and reports the range in `searchInformation.dateRange`.\n (required)") + _ = cmd.MarkFlagRequired("q") + cmd.Flags().StringVar(&p_returnDateVar, "return-date", "", "returnDate Return date or window: When to return, in the same exact-or-window spelling as `outboundDate`, which is required alongside it.\n\nCannot be combined with `travelDuration` or `tripLength` — all three set the trip length. Ignored when `type` is `oneWay`.\n") + cmd.Flags().StringVar(&p_stopsVar, "stops", "", "stops Stops: Maximum number of stops. Requires `arrivalId`. Omitted, any number is allowed.\n\n - `1` / `nonStop` — direct flights only\n - `2` / `oneStopOrFewer` — at most one connection\n - `3` / `twoStopsOrFewer` — at most two connections\n\nA route with nothing at that depth returns an empty `flightDeals` array, not an error — `nonStop` on a route without a direct flight is a valid, empty answer.\n [allowed: 1|nonStop|2|oneStopOrFewer|3|twoStopsOrFewer]") + _ = cmd.RegisterFlagCompletionFunc("stops", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"1", "nonStop", "2", "oneStopOrFewer", "3", "twoStopsOrFewer"}, cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().StringVar(&p_travelClassVar, "travel-class", "", "travelClass Travel class: Travel class. Requires `arrivalId`.\n\n - `1` / `economy` — economy (default)\n - `2` / `premiumEconomy` — premium economy\n - `3` / `business` — business\n - `4` / `first` — first\n\nFares climb steeply: on LAX-NRT the same search ran $730 in economy against $2882 in business.\n [allowed: 1|economy|2|premiumEconomy|3|business|4|first]") + _ = cmd.RegisterFlagCompletionFunc("travel-class", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"1", "economy", "2", "premiumEconomy", "3", "business", "4", "first"}, cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().StringVar(&p_travelDurationVar, "travel-duration", "", "travelDuration Trip duration preset: Preset trip length. Requires `arrivalId`. Cannot be combined with `returnDate` or `tripLength`.\n\n - `1` / `week` — about a week (6-8 days)\n - `2` / `weekend` — a weekend (2-3 days)\n - `3` / `twoWeeks` — about two weeks (13-15 days)\n\nPairs with `outboundDate` to limit the departure period. Ignored when `type` is `oneWay`.\n [allowed: 1|week|2|weekend|3|twoWeeks]") + _ = cmd.RegisterFlagCompletionFunc("travel-duration", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"1", "week", "2", "weekend", "3", "twoWeeks"}, cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().StringVar(&p_tripLengthVar, "trip-length", "", "tripLength Trip length in days: Trip length in days. Requires `arrivalId`. Cannot be combined with `returnDate` or `travelDuration`.\n\n - **Exact**: `7`\n - **Range**: `5,10` — min first\n\nPairs with `outboundDate` to limit the departure period. Ignored when `type` is `oneWay`.\n") + cmd.Flags().StringVar(&p_typeVar, "type", "", "type Flight type: Flight type. Requires `arrivalId`.\n\n - `1` / `roundTrip` — round trip (default)\n - `2` / `oneWay` — one way\n\nA one-way deal carries no `returnDate` and no `tripLengthDays`.\n [allowed: 1|roundTrip|2|oneWay]") + _ = cmd.RegisterFlagCompletionFunc("type", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"1", "roundTrip", "2", "oneWay"}, cobra.ShellCompDirectiveNoFileComp + }) + + return cmd +} + +func init() { + RegisterAPICommand("google_travel", "Google Travel", newGoogleFlightsDealsCmd()) +} diff --git a/cmd/gen_google_hotels.go b/cmd/gen_google_hotels.go index 1a4788a..23ef626 100644 --- a/cmd/gen_google_hotels.go +++ b/cmd/gen_google_hotels.go @@ -168,9 +168,9 @@ func newGoogleHotelsCmd() *cobra.Command { cmd.Flags().IntVar(&p_bathroomsVar, "bathrooms", 0, "bathrooms Bathrooms: Minimum number of bathrooms (vacation rentals only).\n") cmd.Flags().IntVar(&p_bedroomsVar, "bedrooms", 0, "bedrooms Bedrooms: Minimum number of bedrooms (vacation rentals only).\n") cmd.Flags().StringVar(&p_brandsVar, "brands", "", "brands Brands: Comma-separated list of brand IDs to filter by. Brand IDs are returned in the response under `brands` for the same query.\n") - cmd.Flags().StringVar(&p_checkInDateVar, "check-in-date", "2026-08-15", "checkInDate Check-in Date: The check-in date in 'yyyy-MM-dd' format.\n (required)") + cmd.Flags().StringVar(&p_checkInDateVar, "check-in-date", "2026-10-19", "checkInDate Check-in Date: The check-in date in 'yyyy-MM-dd' format.\n (required)") _ = cmd.MarkFlagRequired("check-in-date") - cmd.Flags().StringVar(&p_checkOutDateVar, "check-out-date", "2026-08-20", "checkOutDate Check-out Date: The check-out date in 'yyyy-MM-dd' format.\n (required)") + cmd.Flags().StringVar(&p_checkOutDateVar, "check-out-date", "2026-10-23", "checkOutDate Check-out Date: The check-out date in 'yyyy-MM-dd' format.\n (required)") _ = cmd.MarkFlagRequired("check-out-date") cmd.Flags().IntVar(&p_childrenVar, "children", 0, "children Children: Number of child guests (1-5). Total guests (adults + children) cannot exceed 6.\n") cmd.Flags().StringVar(&p_childrenAgesVar, "children-ages", "", "childrenAges Children Ages: Comma-separated list of children ages (e.g., `5,8,12`). Must match the number of children.\n") diff --git a/cmd/gen_google_images.go b/cmd/gen_google_images.go index 42435ed..cea43ae 100644 --- a/cmd/gen_google_images.go +++ b/cmd/gen_google_images.go @@ -33,8 +33,8 @@ func newGoogleImagesCmd() *cobra.Command { cmd := &cobra.Command{ Use: "google-images", - Short: "Google Images API (5 credits/call)", - Long: "Provides real-time access to Google image search results, tailored to specific parameters, ensuring efficient and reliable retrieval at scale.\n\nEndpoint: GET https://api.hasdata.com/scrape/google/images\nCost: 5 credits per call.", + Short: "Google Images API (10 credits/call)", + Long: "Provides real-time access to Google image search results, tailored to specific parameters, ensuring efficient and reliable retrieval at scale.\n\nEndpoint: GET https://api.hasdata.com/scrape/google/images\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { if c.Flags().Changed("device-type") { diff --git a/cmd/gen_google_immersive_product.go b/cmd/gen_google_immersive_product.go index 23ae29b..5d737c6 100644 --- a/cmd/gen_google_immersive_product.go +++ b/cmd/gen_google_immersive_product.go @@ -25,8 +25,8 @@ func newGoogleImmersiveProductCmd() *cobra.Command { cmd := &cobra.Command{ Use: "google-immersive-product", - Short: "Google Immersive Product API (5 credits/call)", - Long: "With the Google Immersive Product API, you can fetch extended product information from the \"Immersive Product\" block, which displays a pop-up with complete details when clicked.\n\nEndpoint: GET https://api.hasdata.com/scrape/google/immersive-product\nCost: 5 credits per call.", + Short: "Google Immersive Product API (10 credits/call)", + Long: "With the Google Immersive Product API, you can fetch extended product information from the \"Immersive Product\" block, which displays a pop-up with complete details when clicked.\n\nEndpoint: GET https://api.hasdata.com/scrape/google/immersive-product\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil diff --git a/cmd/gen_google_maps.go b/cmd/gen_google_maps.go index 288cadc..7f2133a 100644 --- a/cmd/gen_google_maps.go +++ b/cmd/gen_google_maps.go @@ -28,8 +28,8 @@ func newGoogleMapsCmd() *cobra.Command { cmd := &cobra.Command{ Use: "google-maps", - Short: "Google Maps Search API (5 credits/call)", - Long: "The Google Maps Search API allows users to search for locations using keyword, coordinates, and various filters. The API returns relevant location details and map data.\n\nEndpoint: GET https://api.hasdata.com/scrape/google-maps/search\nCost: 5 credits per call.", + Short: "Google Maps Search API (10 credits/call)", + Long: "The Google Maps Search API allows users to search for locations using keyword, coordinates, and various filters. The API returns relevant location details and map data.\n\nEndpoint: GET https://api.hasdata.com/scrape/google-maps/search\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { if c.Flags().Changed("domain") { diff --git a/cmd/gen_google_maps_contributor_reviews.go b/cmd/gen_google_maps_contributor_reviews.go index d000571..244a6a8 100644 --- a/cmd/gen_google_maps_contributor_reviews.go +++ b/cmd/gen_google_maps_contributor_reviews.go @@ -27,8 +27,8 @@ func newGoogleMapsContributorReviewsCmd() *cobra.Command { cmd := &cobra.Command{ Use: "google-maps-contributor-reviews", - Short: "Google Maps Contributor Reviews API (5 credits/call)", - Long: "The Google Maps Contributor Reviews API allows to retrieve reviews submitted by specific users on Google Maps.\n\nEndpoint: GET https://api.hasdata.com/scrape/google-maps/contributor-reviews\nCost: 5 credits per call.", + Short: "Google Maps Contributor Reviews API (10 credits/call)", + Long: "The Google Maps Contributor Reviews API allows to retrieve reviews submitted by specific users on Google Maps.\n\nEndpoint: GET https://api.hasdata.com/scrape/google-maps/contributor-reviews\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil diff --git a/cmd/gen_google_maps_photos.go b/cmd/gen_google_maps_photos.go index 4922c22..b641459 100644 --- a/cmd/gen_google_maps_photos.go +++ b/cmd/gen_google_maps_photos.go @@ -27,8 +27,8 @@ func newGoogleMapsPhotosCmd() *cobra.Command { cmd := &cobra.Command{ Use: "google-maps-photos", - Short: "Google Maps Photos API (5 credits/call)", - Long: "The Google Maps Photos API returns photos for a place on Google Maps. Use either dataId or placeId with optional language, category, and pagination.\n\nEndpoint: GET https://api.hasdata.com/scrape/google-maps/photos\nCost: 5 credits per call.", + Short: "Google Maps Photos API (10 credits/call)", + Long: "The Google Maps Photos API returns photos for a place on Google Maps. Use either dataId or placeId with optional language, category, and pagination.\n\nEndpoint: GET https://api.hasdata.com/scrape/google-maps/photos\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil diff --git a/cmd/gen_google_maps_place.go b/cmd/gen_google_maps_place.go index 1587011..a2a7a25 100644 --- a/cmd/gen_google_maps_place.go +++ b/cmd/gen_google_maps_place.go @@ -20,13 +20,14 @@ var ( func newGoogleMapsPlaceCmd() *cobra.Command { var p_domainVar string + var p_fetchWebResultsVar bool var p_hlVar string var p_placeIdVar string cmd := &cobra.Command{ Use: "google-maps-place", - Short: "Google Maps Place API (5 credits/call)", - Long: "The Google Maps Place API retrieves detailed information about a specific place using a `placeId`.\n\nEndpoint: GET https://api.hasdata.com/scrape/google-maps/place\nCost: 5 credits per call.", + Short: "Google Maps Place API (10 credits/call)", + Long: "The Google Maps Place API retrieves detailed information about a specific place using a `placeId`.\n\nEndpoint: GET https://api.hasdata.com/scrape/google-maps/place\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { if c.Flags().Changed("domain") { @@ -46,6 +47,9 @@ func newGoogleMapsPlaceCmd() *cobra.Command { if c.Flags().Changed("domain") { params.Set("domain", p_domainVar) } + if c.Flags().Changed("fetch-web-results") { + params.Set("fetchWebResults", strconv.FormatBool(p_fetchWebResultsVar)) + } if c.Flags().Changed("hl") { params.Set("hl", p_hlVar) } @@ -61,6 +65,7 @@ func newGoogleMapsPlaceCmd() *cobra.Command { _ = cmd.RegisterFlagCompletionFunc("domain", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { return []string{"google.ac", "google.ad", "google.ae", "google.al", "google.am", "google.as", "google.at", "google.az", "google.ba", "google.be", "google.bf", "google.bg", "google.bi", "google.bj", "google.bs", "google.bt", "google.by", "google.ca", "google.cd", "google.cf", "google.cg", "google.ch", "google.ci", "google.cl", "google.cm", "google.co.ao", "google.co.bw", "google.co.ck", "google.co.cr", "google.co.id", "google.co.il", "google.co.in", "google.co.jp", "google.co.ke", "google.co.kr", "google.co.ls", "google.co.ma", "google.co.mz", "google.co.nz", "google.co.th", "google.co.tz", "google.co.ug", "google.co.uk", "google.co.uz", "google.co.ve", "google.co.vi", "google.co.za", "google.co.zm", "google.co.zw", "google.com", "google.com.af", "google.com.ag", "google.com.ai", "google.com.ar", "google.com.au", "google.com.bd", "google.com.bh", "google.com.bn", "google.com.bo", "google.com.br", "google.com.bz", "google.com.co", "google.com.cu", "google.com.cy", "google.com.do", "google.com.ec", "google.com.eg", "google.com.et", "google.com.fj", "google.com.gh", "google.com.gi", "google.com.gt", "google.com.hk", "google.com.jm", "google.com.kh", "google.com.kw", "google.com.lb", "google.com.ly", "google.com.mm", "google.com.mt", "google.com.mx", "google.com.my", "google.com.na", "google.com.ng", "google.ng", "google.com.nf", "google.com.ni", "google.com.np", "google.com.om", "google.com.pa", "google.com.pe", "google.com.pg", "google.com.ph", "google.com.pk", "google.com.pr", "google.com.py", "google.com.qa", "google.com.sa", "google.com.sb", "google.com.sg", "google.com.sl", "google.com.sv", "google.com.tj", "google.com.tr", "google.com.tw", "google.com.ua", "google.com.uy", "google.com.vc", "google.com.vn", "google.cat", "google.cn", "google.cv", "google.cz", "google.de", "google.dj", "google.dk", "google.dm", "google.dz", "google.ee", "google.es", "google.fi", "google.fm", "google.fr", "google.ga", "google.ge", "google.gg", "google.gl", "google.gm", "google.gp", "google.gr", "google.gy", "google.hn", "google.hr", "google.ht", "google.hu", "google.ie", "google.im", "google.iq", "google.is", "google.it", "google.je", "google.jo", "google.kg", "google.ki", "google.kz", "google.la", "google.li", "google.lk", "google.lt", "google.lu", "google.lv", "google.md", "google.me", "google.mg", "google.mk", "google.ml", "google.mn", "google.ms", "google.mu", "google.mv", "google.mw", "google.ne", "google.nl", "google.no", "google.nr", "google.nu", "google.pl", "google.pn", "google.ps", "google.pt", "google.ro", "google.rs", "google.ru", "google.rw", "google.sc", "google.se", "google.sh", "google.si", "google.sk", "google.sm", "google.sn", "google.so", "google.sr", "google.st", "google.td", "google.tg", "google.tk", "google.tl", "google.tm", "google.tn", "google.to", "google.tt", "google.vg", "google.vu", "google.ws"}, cobra.ShellCompDirectiveNoFileComp }) + cmd.Flags().BoolVar(&p_fetchWebResultsVar, "fetch-web-results", false, "fetchWebResults Fetch Web Results: Also collect the place panel's \"Web results\" section (the business's website and its pages on Instagram, Facebook, delivery services, etc.) and return it as `webResults`. This takes an extra request to Google and costs 5 credits on top of the base. Default is false.") cmd.Flags().StringVar(&p_hlVar, "hl", "", "hl Language: The two-letter language code for the language you want to use for the search.") cmd.Flags().StringVar(&p_placeIdVar, "place-id", "ChIJFU2bda4SM4cRKSCRyb6pOB8", "placeId Google Place ID: A unique identifier for the place. This ID can be obtained from Google Maps search results. (required)") _ = cmd.MarkFlagRequired("place-id") diff --git a/cmd/gen_google_maps_posts.go b/cmd/gen_google_maps_posts.go index 1e17dac..cc54d21 100644 --- a/cmd/gen_google_maps_posts.go +++ b/cmd/gen_google_maps_posts.go @@ -21,7 +21,6 @@ var ( func newGoogleMapsPostsCmd() *cobra.Command { var p_dataIdVar string var p_hlVar string - var p_nextPageTokenVar string var p_placeIdVar string cmd := &cobra.Command{ @@ -45,9 +44,6 @@ func newGoogleMapsPostsCmd() *cobra.Command { if c.Flags().Changed("hl") { params.Set("hl", p_hlVar) } - if c.Flags().Changed("next-page-token") { - params.Set("nextPageToken", p_nextPageTokenVar) - } if c.Flags().Changed("place-id") { params.Set("placeId", p_placeIdVar) } @@ -60,7 +56,6 @@ func newGoogleMapsPostsCmd() *cobra.Command { } cmd.Flags().StringVar(&p_dataIdVar, "data-id", "0x873312ae759b4d15:0x1f38a9bec9912029", "dataId Data ID: Google Maps data ID.") cmd.Flags().StringVar(&p_hlVar, "hl", "", "hl Language: The two-letter language code for the language you want to use for the search.") - cmd.Flags().StringVar(&p_nextPageTokenVar, "next-page-token", "", "nextPageToken Next Page Token: Defines the next page token. It is used for retrieving the next page results.") cmd.Flags().StringVar(&p_placeIdVar, "place-id", "", "placeId Place ID: Unique reference to a place on a Google Map. Either dataId or placeId should be set.") return cmd diff --git a/cmd/gen_google_maps_reviews.go b/cmd/gen_google_maps_reviews.go index 6faa371..d963d56 100644 --- a/cmd/gen_google_maps_reviews.go +++ b/cmd/gen_google_maps_reviews.go @@ -28,8 +28,8 @@ func newGoogleMapsReviewsCmd() *cobra.Command { cmd := &cobra.Command{ Use: "google-maps-reviews", - Short: "Google Maps Reviews API (5 credits/call)", - Long: "The Google Maps Reviews API provides access to reviews from Google Maps, with options to specify the data ID, place ID, language, sorting parameters, and topic filters.\n\nEndpoint: GET https://api.hasdata.com/scrape/google-maps/reviews\nCost: 5 credits per call.", + Short: "Google Maps Reviews API (10 credits/call)", + Long: "The Google Maps Reviews API provides access to reviews from Google Maps, with options to specify the data ID, place ID, language, sorting parameters, and topic filters.\n\nEndpoint: GET https://api.hasdata.com/scrape/google-maps/reviews\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { if c.Flags().Changed("sort-by") { diff --git a/cmd/gen_google_scholar.go b/cmd/gen_google_scholar.go new file mode 100644 index 0000000..eb5b918 --- /dev/null +++ b/cmd/gen_google_scholar.go @@ -0,0 +1,143 @@ +// Code generated by internal/gen. DO NOT EDIT. + +package cmd + +import ( + "encoding/json" + "fmt" + "net/url" + "strconv" + + "github.com/spf13/cobra" +) + +var ( + _ = json.Marshal + _ = fmt.Sprintf + _ = url.Values{} + _ = strconv.Itoa +) + +func newGoogleScholarCmd() *cobra.Command { + var p_asRrVar float64 + var p_asSdtVar string + var p_asVisVar float64 + var p_asYhiVar int + var p_asYloVar int + var p_citesVar string + var p_clusterVar string + var p_filterVar float64 + var p_hlVar string + var p_lrVar []string + var p_numVar int + var p_qVar string + var p_safeVar string + var p_scisbdVar int + var p_startVar int + + cmd := &cobra.Command{ + Use: "google-scholar", + Short: "Google Scholar API (10 credits/call)", + Long: "Provides real-time access to Google Scholar search results, including papers, citations, and related scholarly metadata.\n\nEndpoint: GET https://api.hasdata.com/scrape/google/scholar\nCost: 10 credits per call.", + Args: cobra.NoArgs, + PreRunE: func(c *cobra.Command, _ []string) error { + if c.Flags().Changed("lr") { + if err := validateEnumStringSlice("lr", p_lrVar, []string{"lang_ar", "lang_hy", "lang_bg", "lang_ca", "lang_cs", "lang_da", "lang_de", "lang_el", "lang_en", "lang_es", "lang_et", "lang_tl", "lang_fi", "lang_fr", "lang_hr", "lang_hi", "lang_hu", "lang_id", "lang_is", "lang_it", "lang_iw", "lang_he", "lang_ja", "lang_ko", "lang_lt", "lang_lv", "lang_nl", "lang_no", "lang_fa", "lang_pl", "lang_pt", "lang_ro", "lang_ru", "lang_sk", "lang_sl", "lang_sr", "lang_sv", "lang_th", "lang_tr", "lang_uk", "lang_vi", "lang_zh-CN", "lang_zh-TW"}); err != nil { + return err + } + } + if c.Flags().Changed("safe") { + if err := validateEnumString("safe", p_safeVar, []string{"active", "off"}); err != nil { + return err + } + } + return nil + }, + RunE: func(c *cobra.Command, _ []string) error { + ctx := c.Context() + cli, err := Client() + if err != nil { + return err + } + params := url.Values{} + if c.Flags().Changed("as-rr") { + params.Set("asRr", strconv.FormatFloat(p_asRrVar, 'f', -1, 64)) + } + if c.Flags().Changed("as-sdt") { + params.Set("asSdt", p_asSdtVar) + } + if c.Flags().Changed("as-vis") { + params.Set("asVis", strconv.FormatFloat(p_asVisVar, 'f', -1, 64)) + } + if c.Flags().Changed("as-yhi") { + params.Set("asYhi", strconv.Itoa(p_asYhiVar)) + } + if c.Flags().Changed("as-ylo") { + params.Set("asYlo", strconv.Itoa(p_asYloVar)) + } + if c.Flags().Changed("cites") { + params.Set("cites", p_citesVar) + } + if c.Flags().Changed("cluster") { + params.Set("cluster", p_clusterVar) + } + if c.Flags().Changed("filter") { + params.Set("filter", strconv.FormatFloat(p_filterVar, 'f', -1, 64)) + } + if c.Flags().Changed("hl") { + params.Set("hl", p_hlVar) + } + if c.Flags().Changed("lr") { + for _, v := range p_lrVar { + params.Add("lr"+"[]", v) + } + } + if c.Flags().Changed("num") { + params.Set("num", strconv.Itoa(p_numVar)) + } + params.Set("q", p_qVar) + if c.Flags().Changed("safe") { + params.Set("safe", p_safeVar) + } + if c.Flags().Changed("scisbd") { + params.Set("scisbd", strconv.Itoa(p_scisbdVar)) + } + if c.Flags().Changed("start") { + params.Set("start", strconv.Itoa(p_startVar)) + } + resp, err := cli.Do(ctx, "GET", "https://api.hasdata.com/scrape/google/scholar", params, nil) + if err != nil { + return err + } + return WriteResponse(c, resp) + }, + } + cmd.Flags().Float64Var(&p_asRrVar, "as-rr", 0, "asRr Review Articles Only: Set to 1 to return review articles only, or 0 (default) to return all articles.") + cmd.Flags().StringVar(&p_asSdtVar, "as-sdt", "0,5", "asSdt Search Type / Filter: Search type/filter. Pick a value below to search case law from a specific court, or use `0,5` for Articles (default) / `7` to include patents. Any comma-separated court-code combination Google Scholar accepts also works here as free text beyond this list.") + cmd.Flags().Float64Var(&p_asVisVar, "as-vis", 0, "asVis Exclude Citations: Set to 1 to exclude citations from the results, or 0 (default) to include them.") + cmd.Flags().IntVar(&p_asYhiVar, "as-yhi", 2024, "asYhi Year To: Return results published up to and including this year.") + cmd.Flags().IntVar(&p_asYloVar, "as-ylo", 2020, "asYlo Year From: Return results published from this year onward.") + cmd.Flags().StringVar(&p_citesVar, "cites", "", "cites Cited By Search: Unique article ID to look up articles that cite it, as returned in a result's `citedBy.citesId`.") + cmd.Flags().StringVar(&p_clusterVar, "cluster", "", "cluster All Versions Search: Unique article ID to look up all indexed versions of that article, as returned in a result's `versions.clusterId`.") + cmd.Flags().Float64Var(&p_filterVar, "filter", 0, "filter Results Filtering: Defines whether to enable or disable the filters for 'Similar Results' and 'Omitted Results'. Set to 1 (default) to enable these filters, or 0 to disable them.\n") + cmd.Flags().StringVar(&p_hlVar, "hl", "", "hl Language: The two-letter language code for the language you want to use for the search.") + cmd.Flags().StringSliceVar(&p_lrVar, "lr", nil, "lr Set Multiple Languages: The 'lr' parameter specifies the language of the websites to return results from. This parameter filters results based on the language of the web content.") + _ = cmd.RegisterFlagCompletionFunc("lr", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"lang_ar", "lang_hy", "lang_bg", "lang_ca", "lang_cs", "lang_da", "lang_de", "lang_el", "lang_en", "lang_es", "lang_et", "lang_tl", "lang_fi", "lang_fr", "lang_hr", "lang_hi", "lang_hu", "lang_id", "lang_is", "lang_it", "lang_iw", "lang_he", "lang_ja", "lang_ko", "lang_lt", "lang_lv", "lang_nl", "lang_no", "lang_fa", "lang_pl", "lang_pt", "lang_ro", "lang_ru", "lang_sk", "lang_sl", "lang_sr", "lang_sv", "lang_th", "lang_tr", "lang_uk", "lang_vi", "lang_zh-CN", "lang_zh-TW"}, cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().IntVar(&p_numVar, "num", 0, "num Number of Results: Maximum number of results to return per page.") + cmd.Flags().StringVar(&p_qVar, "q", "machine learning", "q Search Query: Search query. Supports Google Scholar search helpers such as `author:` and `source:`. (required)") + _ = cmd.MarkFlagRequired("q") + cmd.Flags().StringVar(&p_safeVar, "safe", "", "safe Adult Content Filtering: Adult content filtering option. [allowed: active|off]") + _ = cmd.RegisterFlagCompletionFunc("safe", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"active", "off"}, cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().IntVar(&p_scisbdVar, "scisbd", 0, "scisbd Sort By Date: Sort results by date instead of relevance: 1 for abstracts only, 2 for everything. Omit for relevance sorting.") + cmd.Flags().IntVar(&p_startVar, "start", 0, "start Result Offset: Result offset for pagination, where 0 is the first result.") + + return cmd +} + +func init() { + RegisterAPICommand("google_scholar", "Google Scholar", newGoogleScholarCmd()) +} diff --git a/cmd/gen_google_scholar_cite.go b/cmd/gen_google_scholar_cite.go new file mode 100644 index 0000000..525e108 --- /dev/null +++ b/cmd/gen_google_scholar_cite.go @@ -0,0 +1,60 @@ +// Code generated by internal/gen. DO NOT EDIT. + +package cmd + +import ( + "encoding/json" + "fmt" + "net/url" + "strconv" + + "github.com/spf13/cobra" +) + +var ( + _ = json.Marshal + _ = fmt.Sprintf + _ = url.Values{} + _ = strconv.Itoa +) + +func newGoogleScholarCiteCmd() *cobra.Command { + var p_hlVar string + var p_qVar string + + cmd := &cobra.Command{ + Use: "google-scholar-cite", + Short: "Google Scholar Cite API (10 credits/call)", + Long: "Provides real-time access to Google Scholar citation formats and reference-manager export links for a single organic search result.\n\nEndpoint: GET https://api.hasdata.com/scrape/google/scholar-cite\nCost: 10 credits per call.", + Args: cobra.NoArgs, + PreRunE: func(c *cobra.Command, _ []string) error { + return nil + }, + RunE: func(c *cobra.Command, _ []string) error { + ctx := c.Context() + cli, err := Client() + if err != nil { + return err + } + params := url.Values{} + if c.Flags().Changed("hl") { + params.Set("hl", p_hlVar) + } + params.Set("q", p_qVar) + resp, err := cli.Do(ctx, "GET", "https://api.hasdata.com/scrape/google/scholar-cite", params, nil) + if err != nil { + return err + } + return WriteResponse(c, resp) + }, + } + cmd.Flags().StringVar(&p_hlVar, "hl", "", "hl Language: The two-letter language code for the language you want to use for the search.") + cmd.Flags().StringVar(&p_qVar, "q", "EQ8shYj8Ai8J", "q Result ID: The `resultId` of a Google Scholar organic result, as returned by the google/scholar endpoint. (required)") + _ = cmd.MarkFlagRequired("q") + + return cmd +} + +func init() { + RegisterAPICommand("google_scholar", "Google Scholar", newGoogleScholarCiteCmd()) +} diff --git a/cmd/gen_google_short_videos.go b/cmd/gen_google_short_videos.go index 01faa2c..03a5fec 100644 --- a/cmd/gen_google_short_videos.go +++ b/cmd/gen_google_short_videos.go @@ -27,12 +27,13 @@ func newGoogleShortVideosCmd() *cobra.Command { var p_lrVar []string var p_pageVar int var p_qVar string + var p_tbsVar string var p_uuleVar string cmd := &cobra.Command{ Use: "google-short-videos", - Short: "Google Short Videos API (5 credits/call)", - Long: "The Google Short Videos API provides real-time access to short-form video content indexed by Google, allowing users to retrieve videos based on specific queries, topics, platforms, and customizable filters for highly relevant video results.\n\nEndpoint: GET https://api.hasdata.com/scrape/google/short-videos\nCost: 5 credits per call.", + Short: "Google Short Videos API (10 credits/call)", + Long: "The Google Short Videos API provides real-time access to short-form video content indexed by Google, allowing users to retrieve videos based on specific queries, topics, platforms, and customizable filters for highly relevant video results.\n\nEndpoint: GET https://api.hasdata.com/scrape/google/short-videos\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { if c.Flags().Changed("device-type") { @@ -78,6 +79,9 @@ func newGoogleShortVideosCmd() *cobra.Command { params.Set("page", strconv.Itoa(p_pageVar)) } params.Set("q", p_qVar) + if c.Flags().Changed("tbs") { + params.Set("tbs", p_tbsVar) + } if c.Flags().Changed("uule") { params.Set("uule", p_uuleVar) } @@ -103,6 +107,7 @@ func newGoogleShortVideosCmd() *cobra.Command { cmd.Flags().IntVar(&p_pageVar, "page", 0, "page Page Number: Page number for paginated results, where 0 is the first page.") cmd.Flags().StringVar(&p_qVar, "q", "Coffee", "q Search Query: Search query term for retrieving short videos results. (required)") _ = cmd.MarkFlagRequired("q") + cmd.Flags().StringVar(&p_tbsVar, "tbs", "", "tbs Advanced Search Parameters: Google advanced search filters, combined with commas. For example:\n\n - `qdr:h`, `qdr:d`, `qdr:w`, `qdr:m`, `qdr:y` - Show videos from the past hour, day, week, month, or year.\n") cmd.Flags().StringVar(&p_uuleVar, "uule", "", "uule Encoded Location: The encoded location parameter.") return cmd diff --git a/cmd/gen_google_trends.go b/cmd/gen_google_trends.go index d2515ba..a842b30 100644 --- a/cmd/gen_google_trends.go +++ b/cmd/gen_google_trends.go @@ -30,8 +30,8 @@ func newGoogleTrendsCmd() *cobra.Command { cmd := &cobra.Command{ Use: "google-trends", - Short: "Google Trends API (5 credits/call)", - Long: "The Google Trends API provides real-time access to Google Trends data, offering insights into the popularity of search terms over time and across regions.\n\nEndpoint: GET https://api.hasdata.com/scrape/google-trends/search\nCost: 5 credits per call.", + Short: "Google Trends API (10 credits/call)", + Long: "The Google Trends API provides real-time access to Google Trends data, offering insights into the popularity of search terms over time and across regions.\n\nEndpoint: GET https://api.hasdata.com/scrape/google-trends/search\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil diff --git a/cmd/gen_indeed_job.go b/cmd/gen_indeed_job.go index 2d06df8..cd79b40 100644 --- a/cmd/gen_indeed_job.go +++ b/cmd/gen_indeed_job.go @@ -23,8 +23,8 @@ func newIndeedJobCmd() *cobra.Command { cmd := &cobra.Command{ Use: "indeed-job", - Short: "Indeed Job Scraper API (5 credits/call)", - Long: "The Indeed Job Scraper API allows you to retrieve detailed information about a specific job listing based on the provided vacancy URL.\n\nEndpoint: GET https://api.hasdata.com/scrape/indeed/job\nCost: 5 credits per call.", + Short: "Indeed Job Scraper API (10 credits/call)", + Long: "The Indeed Job Scraper API allows you to retrieve detailed information about a specific job listing based on the provided vacancy URL.\n\nEndpoint: GET https://api.hasdata.com/scrape/indeed/job\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil diff --git a/cmd/gen_indeed_listing.go b/cmd/gen_indeed_listing.go index dc4edfa..2827265 100644 --- a/cmd/gen_indeed_listing.go +++ b/cmd/gen_indeed_listing.go @@ -27,8 +27,8 @@ func newIndeedListingCmd() *cobra.Command { cmd := &cobra.Command{ Use: "indeed-listing", - Short: "Indeed Listing Scraper API (5 credits/call)", - Long: "The Indeed Listing Scraper API allows you to retrieve job listings from Indeed based on various search parameters.\n\nEndpoint: GET https://api.hasdata.com/scrape/indeed/listing\nCost: 5 credits per call.", + Short: "Indeed Listing Scraper API (10 credits/call)", + Long: "The Indeed Listing Scraper API allows you to retrieve job listings from Indeed based on various search parameters.\n\nEndpoint: GET https://api.hasdata.com/scrape/indeed/listing\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { if c.Flags().Changed("domain") { diff --git a/cmd/gen_instagram_comments.go b/cmd/gen_instagram_comments.go new file mode 100644 index 0000000..a5af632 --- /dev/null +++ b/cmd/gen_instagram_comments.go @@ -0,0 +1,78 @@ +// Code generated by internal/gen. DO NOT EDIT. + +package cmd + +import ( + "encoding/json" + "fmt" + "net/url" + "strconv" + + "github.com/spf13/cobra" +) + +var ( + _ = json.Marshal + _ = fmt.Sprintf + _ = url.Values{} + _ = strconv.Itoa +) + +func newInstagramCommentsCmd() *cobra.Command { + var p_includeMusicVar bool + var p_includeMusicVarNeg bool + var p_nextPageTokenVar string + var p_urlVar string + + cmd := &cobra.Command{ + Use: "instagram-comments", + Short: "Instagram Comments Scraper API (10 credits/call)", + Long: "The Instagram Comments Scraper API returns the comments on a public Instagram post or reel by its URL. The first page also returns the post itself with caption, likes and comments counts, and every image or video in the post, including all carousel items. Each comment includes its text, like count, reply count, timestamp, and author (with a link to the author's profile). Results are paginated with a token.\n\nEndpoint: GET https://api.hasdata.com/scrape/instagram/comments\nCost: 10 credits per call.", + Args: cobra.NoArgs, + PreRunE: func(c *cobra.Command, _ []string) error { + if c.Flags().Changed("include-music") && c.Flags().Changed("no-"+"include-music") { + return fmt.Errorf("cannot set both --%s and --no-%s", "include-music", "include-music") + } + return nil + }, + RunE: func(c *cobra.Command, _ []string) error { + ctx := c.Context() + cli, err := Client() + if err != nil { + return err + } + params := url.Values{} + { + val := p_includeMusicVar + changed := c.Flags().Changed("include-music") + if c.Flags().Changed("no-" + "include-music") { + val = !p_includeMusicVarNeg + changed = true + } + if changed { + params.Set("includeMusic", strconv.FormatBool(val)) + } + } + if c.Flags().Changed("next-page-token") { + params.Set("nextPageToken", p_nextPageTokenVar) + } + params.Set("url", p_urlVar) + resp, err := cli.Do(ctx, "GET", "https://api.hasdata.com/scrape/instagram/comments", params, nil) + if err != nil { + return err + } + return WriteResponse(c, resp) + }, + } + cmd.Flags().BoolVar(&p_includeMusicVar, "include-music", true, "includeMusic Include Music: Also return the reel's sound (audio ID, artist and song title) in `post.music`, for both licensed tracks and original audio. This takes an extra request to Instagram on the first page and is ignored when `nextPageToken` is set. Default is false.") + cmd.Flags().BoolVar(&p_includeMusicVarNeg, "no-"+"include-music", false, "disable --include-music") + cmd.Flags().StringVar(&p_nextPageTokenVar, "next-page-token", "", "nextPageToken Next Page Token: Defines the next page token. Use the `nextPageToken` value returned by the previous response. Omit it to fetch the first page.") + cmd.Flags().StringVar(&p_urlVar, "url", "https://www.instagram.com/instagram/p/Ddjis3vETcP/", "url Post URL: The URL of the Instagram post or reel, for example `https://www.instagram.com/p/Ddjis3vETcP/` or `https://www.instagram.com/instagram/reel/DcymgItMFao/`. (required)") + _ = cmd.MarkFlagRequired("url") + + return cmd +} + +func init() { + RegisterAPICommand("social", "Social", newInstagramCommentsCmd()) +} diff --git a/cmd/gen_instagram_posts.go b/cmd/gen_instagram_posts.go index 1dfe59d..20951b9 100644 --- a/cmd/gen_instagram_posts.go +++ b/cmd/gen_instagram_posts.go @@ -25,8 +25,8 @@ func newInstagramPostsCmd() *cobra.Command { cmd := &cobra.Command{ Use: "instagram-posts", - Short: "Instagram Posts Scraper API (5 credits/call)", - Long: "The Instagram Posts Scraper API lets you retrieve the latest posts of a public Instagram account using its handle. It returns posts with captions, hashtags, mentions, likes, comments, and plays counts, image and video URLs, and timestamps, with token-based pagination for retrieving older posts.\n\nEndpoint: GET https://api.hasdata.com/scrape/instagram/posts\nCost: 5 credits per call.", + Short: "Instagram Posts Scraper API (10 credits/call)", + Long: "The Instagram Posts Scraper API lets you retrieve the latest posts of a public Instagram account using its handle. It returns posts with captions, hashtags, mentions, likes, comments, and plays counts, image and video URLs, and timestamps, with token-based pagination for retrieving older posts.\n\nEndpoint: GET https://api.hasdata.com/scrape/instagram/posts\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil diff --git a/cmd/gen_instagram_profile.go b/cmd/gen_instagram_profile.go index d3a9567..61ef364 100644 --- a/cmd/gen_instagram_profile.go +++ b/cmd/gen_instagram_profile.go @@ -23,8 +23,8 @@ func newInstagramProfileCmd() *cobra.Command { cmd := &cobra.Command{ Use: "instagram-profile", - Short: "Instagram Profile Scraper API (5 credits/call)", - Long: "The Instagram Profile Scraper API lets you retrieve public profile information for a specific Instagram account using its handle. It returns data such as bio, followers, following, posts count, and other visible profile details.\n\nEndpoint: GET https://api.hasdata.com/scrape/instagram/profile\nCost: 5 credits per call.", + Short: "Instagram Profile Scraper API (10 credits/call)", + Long: "The Instagram Profile Scraper API lets you retrieve public profile information for a specific Instagram account using its handle. It returns data such as bio, followers, following, posts count, and other visible profile details.\n\nEndpoint: GET https://api.hasdata.com/scrape/instagram/profile\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil diff --git a/cmd/gen_redfin_listing.go b/cmd/gen_redfin_listing.go index 1556c1a..2f392af 100644 --- a/cmd/gen_redfin_listing.go +++ b/cmd/gen_redfin_listing.go @@ -81,8 +81,8 @@ func newRedfinListingCmd() *cobra.Command { cmd := &cobra.Command{ Use: "redfin-listing", - Short: "Redfin Listing Scraper API (5 credits/call)", - Long: "The Redfin Listing Scraper API allows you to retrieve real estate listings from Redfin based on various search parameters.\n\nEndpoint: GET https://api.hasdata.com/scrape/redfin/listing\nCost: 5 credits per call.", + Short: "Redfin Listing Scraper API (10 credits/call)", + Long: "The Redfin Listing Scraper API allows you to retrieve real estate listings from Redfin based on various search parameters.\n\nEndpoint: GET https://api.hasdata.com/scrape/redfin/listing\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { if c.Flags().Changed("baths") { @@ -596,5 +596,5 @@ func newRedfinListingCmd() *cobra.Command { } func init() { - RegisterAPICommand("redfin", "Redfin", newRedfinListingCmd()) + RegisterAPICommand("real_estate", "Real Estate", newRedfinListingCmd()) } diff --git a/cmd/gen_redfin_property.go b/cmd/gen_redfin_property.go index d28ec43..149ebaf 100644 --- a/cmd/gen_redfin_property.go +++ b/cmd/gen_redfin_property.go @@ -23,8 +23,8 @@ func newRedfinPropertyCmd() *cobra.Command { cmd := &cobra.Command{ Use: "redfin-property", - Short: "Redfin Property Scraper API (5 credits/call)", - Long: "The Redfin Property Scraper API allows users to retrieve detailed information about a specific property using its URL. It provides details such as property features, price, and agent contacts.\n\nEndpoint: GET https://api.hasdata.com/scrape/redfin/property\nCost: 5 credits per call.", + Short: "Redfin Property Scraper API (10 credits/call)", + Long: "The Redfin Property Scraper API allows users to retrieve detailed information about a specific property using its URL. It provides details such as property features, price, and agent contacts.\n\nEndpoint: GET https://api.hasdata.com/scrape/redfin/property\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil @@ -51,5 +51,5 @@ func newRedfinPropertyCmd() *cobra.Command { } func init() { - RegisterAPICommand("redfin", "Redfin", newRedfinPropertyCmd()) + RegisterAPICommand("real_estate", "Real Estate", newRedfinPropertyCmd()) } diff --git a/cmd/gen_shopify_collections.go b/cmd/gen_shopify_collections.go index cd6cec6..fd7eefe 100644 --- a/cmd/gen_shopify_collections.go +++ b/cmd/gen_shopify_collections.go @@ -25,8 +25,8 @@ func newShopifyCollectionsCmd() *cobra.Command { cmd := &cobra.Command{ Use: "shopify-collections", - Short: "Shopify Collections Scraper API (5 credits/call)", - Long: "The Shopify Collections Scraper API allows users to retrieve information about collections in a Shopify store, including details such as title, handle, description, and image.\n\nEndpoint: GET https://api.hasdata.com/scrape/shopify/collections\nCost: 5 credits per call.", + Short: "Shopify Collections Scraper API (10 credits/call)", + Long: "The Shopify Collections Scraper API allows users to retrieve information about collections in a Shopify store, including details such as title, handle, description, and image.\n\nEndpoint: GET https://api.hasdata.com/scrape/shopify/collections\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil @@ -61,5 +61,5 @@ func newShopifyCollectionsCmd() *cobra.Command { } func init() { - RegisterAPICommand("shopify", "Shopify", newShopifyCollectionsCmd()) + RegisterAPICommand("ecommerce", "E-commerce", newShopifyCollectionsCmd()) } diff --git a/cmd/gen_shopify_products.go b/cmd/gen_shopify_products.go index 3d2ba7e..f0bbdcf 100644 --- a/cmd/gen_shopify_products.go +++ b/cmd/gen_shopify_products.go @@ -26,8 +26,8 @@ func newShopifyProductsCmd() *cobra.Command { cmd := &cobra.Command{ Use: "shopify-products", - Short: "Shopify Products Scraper API (5 credits/call)", - Long: "The Shopify Products Scraper API allows users to retrieve product information from a Shopify store using the provided URL, with options to limit the results and filter by collection.\n\nEndpoint: GET https://api.hasdata.com/scrape/shopify/products\nCost: 5 credits per call.", + Short: "Shopify Products Scraper API (10 credits/call)", + Long: "The Shopify Products Scraper API allows users to retrieve product information from a Shopify store using the provided URL, with options to limit the results and filter by collection.\n\nEndpoint: GET https://api.hasdata.com/scrape/shopify/products\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil @@ -66,5 +66,5 @@ func newShopifyProductsCmd() *cobra.Command { } func init() { - RegisterAPICommand("shopify", "Shopify", newShopifyProductsCmd()) + RegisterAPICommand("ecommerce", "E-commerce", newShopifyProductsCmd()) } diff --git a/cmd/gen_walmart_product.go b/cmd/gen_walmart_product.go new file mode 100644 index 0000000..b2d0d95 --- /dev/null +++ b/cmd/gen_walmart_product.go @@ -0,0 +1,92 @@ +// Code generated by internal/gen. DO NOT EDIT. + +package cmd + +import ( + "encoding/json" + "fmt" + "net/url" + "strconv" + + "github.com/spf13/cobra" +) + +var ( + _ = json.Marshal + _ = fmt.Sprintf + _ = url.Values{} + _ = strconv.Itoa +) + +func newWalmartProductCmd() *cobra.Command { + var p_domainVar string + var p_itemIdVar string + var p_languageVar string + var p_otherOffersVar bool + var p_urlVar string + + cmd := &cobra.Command{ + Use: "walmart-product", + Short: "Walmart Product Scraper API (10 credits/call)", + Long: "The Walmart Product Scraper API returns the full detail page of a single Walmart item, and optionally the offers of other sellers competing for the same product.\n\nEndpoint: GET https://api.hasdata.com/scrape/walmart/product\nCost: 10 credits per call.", + Args: cobra.NoArgs, + PreRunE: func(c *cobra.Command, _ []string) error { + if c.Flags().Changed("domain") { + if err := validateEnumString("domain", p_domainVar, []string{"walmart.com", "walmart.ca"}); err != nil { + return err + } + } + if c.Flags().Changed("language") { + if err := validateEnumString("language", p_languageVar, []string{"en", "es", "fr"}); err != nil { + return err + } + } + return nil + }, + RunE: func(c *cobra.Command, _ []string) error { + ctx := c.Context() + cli, err := Client() + if err != nil { + return err + } + params := url.Values{} + if c.Flags().Changed("domain") { + params.Set("domain", p_domainVar) + } + if c.Flags().Changed("item-id") { + params.Set("itemId", p_itemIdVar) + } + if c.Flags().Changed("language") { + params.Set("language", p_languageVar) + } + if c.Flags().Changed("other-offers") { + params.Set("otherOffers", strconv.FormatBool(p_otherOffersVar)) + } + if c.Flags().Changed("url") { + params.Set("url", p_urlVar) + } + resp, err := cli.Do(ctx, "GET", "https://api.hasdata.com/scrape/walmart/product", params, nil) + if err != nil { + return err + } + return WriteResponse(c, resp) + }, + } + cmd.Flags().StringVar(&p_domainVar, "domain", "", "domain Domain: Walmart storefront the item belongs to. Each storefront has its own catalog, item ids, prices and currency, so an id from one storefront does not resolve on another. Ignored when `url` is provided. Default is `walmart.com`. [allowed: walmart.com|walmart.ca]") + _ = cmd.RegisterFlagCompletionFunc("domain", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"walmart.com", "walmart.ca"}, cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().StringVar(&p_itemIdVar, "item-id", "14977205582", "itemId Item ID: Walmart item id, taken from a product URL or from the id field of the Walmart Search API response. On `walmart.com` it is numeric (for example `14977205582`), on `walmart.ca` an alphanumeric code (for example `6NZMJ5CW6MH2`). Required unless `url` is provided.") + cmd.Flags().StringVar(&p_languageVar, "language", "en", "language Language: Language of the product details. Availability depends on the storefront - `walmart.com` serves `en` and `es`, `walmart.ca` serves `en` and `fr`. A language the storefront does not support falls back to its default. [allowed: en|es|fr]") + _ = cmd.RegisterFlagCompletionFunc("language", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"en", "es", "fr"}, cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().BoolVar(&p_otherOffersVar, "other-offers", false, "otherOffers Other Sellers: Also collect the offers of other sellers competing for this item - each seller name, storefront, price, condition, shipping cost, delivery date and return policy. This takes an extra request to Walmart and costs 5 credits on top of the base 10, whether or not the item turns out to have competing sellers. How many competitors the item advertises, and the cheapest competing price, are returned in the `otherOffers` block whether the switch is on or off, so it can be left off until the count shows there is something to collect. Default is `false`.") + cmd.Flags().StringVar(&p_urlVar, "url", "https://www.walmart.com/ip/Samsung-Galaxy-S25-Ultra-256GB-Unlocked-Android-Cell-Phone-with-200MP-Camera-Titanium-Blue/14977205582", "url Product URL: A full Walmart product URL to scrape as is. When provided, it overrides `itemId` and the storefront is taken from the URL itself. Required unless `itemId` is provided.") + + return cmd +} + +func init() { + RegisterAPICommand("ecommerce", "E-commerce", newWalmartProductCmd()) +} diff --git a/cmd/gen_walmart_reviews.go b/cmd/gen_walmart_reviews.go new file mode 100644 index 0000000..d86034e --- /dev/null +++ b/cmd/gen_walmart_reviews.go @@ -0,0 +1,125 @@ +// Code generated by internal/gen. DO NOT EDIT. + +package cmd + +import ( + "encoding/json" + "fmt" + "net/url" + "strconv" + + "github.com/spf13/cobra" +) + +var ( + _ = json.Marshal + _ = fmt.Sprintf + _ = url.Values{} + _ = strconv.Itoa +) + +func newWalmartReviewsCmd() *cobra.Command { + var p_aspectIdVar string + var p_conditionVar string + var p_domainVar string + var p_itemIdVar string + var p_languageVar string + var p_pageVar int + var p_ratingVar int + var p_sortVar string + var p_urlVar string + var p_verifiedPurchasesOnlyVar bool + + cmd := &cobra.Command{ + Use: "walmart-reviews", + Short: "Walmart Reviews Scraper API (10 credits/call)", + Long: "The Walmart Reviews Scraper API returns the customer reviews of a single Walmart item, ten a page, with the sorting and filtering the product page itself offers.\n\nEndpoint: GET https://api.hasdata.com/scrape/walmart/reviews\nCost: 10 credits per call.", + Args: cobra.NoArgs, + PreRunE: func(c *cobra.Command, _ []string) error { + if c.Flags().Changed("domain") { + if err := validateEnumString("domain", p_domainVar, []string{"walmart.com", "walmart.ca"}); err != nil { + return err + } + } + if c.Flags().Changed("language") { + if err := validateEnumString("language", p_languageVar, []string{"en", "es", "fr"}); err != nil { + return err + } + } + if c.Flags().Changed("sort") { + if err := validateEnumString("sort", p_sortVar, []string{"mostRelevant", "mostRecent", "mostHelpful", "highestRated", "lowestRated", "oldest"}); err != nil { + return err + } + } + return nil + }, + RunE: func(c *cobra.Command, _ []string) error { + ctx := c.Context() + cli, err := Client() + if err != nil { + return err + } + params := url.Values{} + if c.Flags().Changed("aspect-id") { + params.Set("aspectId", p_aspectIdVar) + } + if c.Flags().Changed("condition") { + params.Set("condition", p_conditionVar) + } + if c.Flags().Changed("domain") { + params.Set("domain", p_domainVar) + } + if c.Flags().Changed("item-id") { + params.Set("itemId", p_itemIdVar) + } + if c.Flags().Changed("language") { + params.Set("language", p_languageVar) + } + if c.Flags().Changed("page") { + params.Set("page", strconv.Itoa(p_pageVar)) + } + if c.Flags().Changed("rating") { + params.Set("rating", strconv.Itoa(p_ratingVar)) + } + if c.Flags().Changed("sort") { + params.Set("sort", p_sortVar) + } + if c.Flags().Changed("url") { + params.Set("url", p_urlVar) + } + if c.Flags().Changed("verified-purchases-only") { + params.Set("verifiedPurchasesOnly", strconv.FormatBool(p_verifiedPurchasesOnlyVar)) + } + resp, err := cli.Do(ctx, "GET", "https://api.hasdata.com/scrape/walmart/reviews", params, nil) + if err != nil { + return err + } + return WriteResponse(c, resp) + }, + } + cmd.Flags().StringVar(&p_aspectIdVar, "aspect-id", "", "aspectId Frequent Mention: Return only reviews mentioning one topic. Send the `value` of the topic you want, taken from the Frequent mentions group of the `filters` block in the response - given `{\"name\": \"Battery Life\", \"value\": \"6049\", \"count\": 8}` you send `6049`, and `count` is how many reviews to expect. **Only one topic per request**, Walmart rejects a list of them. Topics belong to the product rather than to Walmart: a phone offers Battery Life or Display, a coffee offers Flavor or Aroma, and some items offer none at all - so make an unfiltered request first and read the block, instead of reusing a topic id across products.") + cmd.Flags().StringVar(&p_conditionVar, "condition", "", "condition Condition: Return only reviews written about one condition of the item. Send the `value` from the Condition group of the `filters` block - given `{\"name\": \"Restored: Like New\", \"value\": \"5\"}` you send `5`. **Only one condition per request.** This group appears for items Walmart sells in several conditions, and only when the request already names one: reach the variant through the `url` parameter with its `conditionGroupCode`, as in `https://www.walmart.com/ip/1028936148?conditionGroupCode=2`, and the block then lists the condition that variant carries. An item sold in a single condition has no such group, and no reviews to separate by it.") + cmd.Flags().StringVar(&p_domainVar, "domain", "", "domain Domain: Walmart storefront the item belongs to. Each storefront has its own catalog, item ids and review pool, so an id from one storefront does not resolve on another. Ignored when `url` is provided. Default is `walmart.com`. [allowed: walmart.com|walmart.ca]") + _ = cmd.RegisterFlagCompletionFunc("domain", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"walmart.com", "walmart.ca"}, cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().StringVar(&p_itemIdVar, "item-id", "1028936148", "itemId Item ID: Walmart item id, taken from a product URL or from the id field of the Walmart Search API response. On `walmart.com` it is numeric (for example `14977205582`), on `walmart.ca` an alphanumeric code (for example `6NZMJ5CW6MH2`). Required unless `url` is provided.") + cmd.Flags().StringVar(&p_languageVar, "language", "en", "language Language: Language of the review page. Availability depends on the storefront - `walmart.com` serves `en` and `es`, `walmart.ca` serves `en` and `fr`. A language the storefront does not support falls back to its default. Reviews themselves are returned in the language their author wrote them in. [allowed: en|es|fr]") + _ = cmd.RegisterFlagCompletionFunc("language", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"en", "es", "fr"}, cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().IntVar(&p_pageVar, "page", 1, "page Page: Page of reviews to return, ten reviews a page. The response reports the last available page in `pagination.totalPages`, the next one in `pagination.nextPage`, and how many reviews the current filters select in `pagination.totalResults`. Note that only reviews carrying written text are paginated, so the ceiling follows `reviewsInformation.totalReviews` rather than the larger `reviewsInformation.totalRatings`. Default is `1`.") + cmd.Flags().IntVar(&p_ratingVar, "rating", 0, "rating Star Rating: Return only reviews carrying this star rating, from `1` to `5`. The Star rating group of the `filters` block lists the ratings this item actually has, each with the `value` to send here and a `count` of how many reviews to expect.") + cmd.Flags().StringVar(&p_sortVar, "sort", "mostRelevant", "sort Sort By: Order of the returned reviews, named as the Walmart review page names it. Default is `mostRelevant`. [allowed: mostRelevant|mostRecent|mostHelpful|highestRated|lowestRated|oldest]") + _ = cmd.RegisterFlagCompletionFunc("sort", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"mostRelevant", "mostRecent", "mostHelpful", "highestRated", "lowestRated", "oldest"}, cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().StringVar(&p_urlVar, "url", "https://www.walmart.com/ip/Restored-Apple-iPhone-14-Carrier-Unlocked-128-GB-Starlight-MPUN3LL-A-Refurbished/1028936148", "url Product URL: A full Walmart product URL whose reviews to scrape. When provided, it overrides `itemId` and the storefront is taken from the URL itself. Required unless `itemId` is provided.") + cmd.Flags().BoolVar(&p_verifiedPurchasesOnlyVar, "verified-purchases-only", false, "verifiedPurchasesOnly Verified Purchases Only: Return only reviews left by customers whose purchase Walmart confirmed. Narrows the pool considerably, since most reviews are unverified or syndicated from the manufacturer.") + + return cmd +} + +func init() { + RegisterAPICommand("ecommerce", "E-commerce", newWalmartReviewsCmd()) +} diff --git a/cmd/gen_walmart_search.go b/cmd/gen_walmart_search.go new file mode 100644 index 0000000..b6ac907 --- /dev/null +++ b/cmd/gen_walmart_search.go @@ -0,0 +1,138 @@ +// Code generated by internal/gen. DO NOT EDIT. + +package cmd + +import ( + "encoding/json" + "fmt" + "net/url" + "strconv" + + "github.com/spf13/cobra" +) + +var ( + _ = json.Marshal + _ = fmt.Sprintf + _ = url.Values{} + _ = strconv.Itoa +) + +func newWalmartSearchCmd() *cobra.Command { + var p_catIdVar string + var p_deliveryTypeVar string + var p_domainVar string + var p_facetVar string + var p_languageVar string + var p_maxPriceVar float64 + var p_minPriceVar float64 + var p_pageVar int + var p_qVar string + var p_sortVar string + var p_urlVar string + + cmd := &cobra.Command{ + Use: "walmart-search", + Short: "Walmart Search Scraper API (10 credits/call)", + Long: "The Walmart Search Scraper API allows users to get search results from Walmart based on the specified query, category and storefront. This API enables searching for products on Walmart.\n\nEndpoint: GET https://api.hasdata.com/scrape/walmart/search\nCost: 10 credits per call.", + Args: cobra.NoArgs, + PreRunE: func(c *cobra.Command, _ []string) error { + if c.Flags().Changed("delivery-type") { + if err := validateEnumString("delivery-type", p_deliveryTypeVar, []string{"shipping", "pickup"}); err != nil { + return err + } + } + if c.Flags().Changed("domain") { + if err := validateEnumString("domain", p_domainVar, []string{"walmart.com", "walmart.ca"}); err != nil { + return err + } + } + if c.Flags().Changed("language") { + if err := validateEnumString("language", p_languageVar, []string{"en", "es", "fr"}); err != nil { + return err + } + } + if c.Flags().Changed("sort") { + if err := validateEnumString("sort", p_sortVar, []string{"bestMatch", "priceLowToHigh", "priceHighToLow", "bestseller", "highlyRated", "newArrivals"}); err != nil { + return err + } + } + return nil + }, + RunE: func(c *cobra.Command, _ []string) error { + ctx := c.Context() + cli, err := Client() + if err != nil { + return err + } + params := url.Values{} + if c.Flags().Changed("cat-id") { + params.Set("catId", p_catIdVar) + } + if c.Flags().Changed("delivery-type") { + params.Set("deliveryType", p_deliveryTypeVar) + } + if c.Flags().Changed("domain") { + params.Set("domain", p_domainVar) + } + if c.Flags().Changed("facet") { + params.Set("facet", p_facetVar) + } + if c.Flags().Changed("language") { + params.Set("language", p_languageVar) + } + if c.Flags().Changed("max-price") { + params.Set("maxPrice", strconv.FormatFloat(p_maxPriceVar, 'f', -1, 64)) + } + if c.Flags().Changed("min-price") { + params.Set("minPrice", strconv.FormatFloat(p_minPriceVar, 'f', -1, 64)) + } + if c.Flags().Changed("page") { + params.Set("page", strconv.Itoa(p_pageVar)) + } + if c.Flags().Changed("q") { + params.Set("q", p_qVar) + } + if c.Flags().Changed("sort") { + params.Set("sort", p_sortVar) + } + if c.Flags().Changed("url") { + params.Set("url", p_urlVar) + } + resp, err := cli.Do(ctx, "GET", "https://api.hasdata.com/scrape/walmart/search", params, nil) + if err != nil { + return err + } + return WriteResponse(c, resp) + }, + } + cmd.Flags().StringVar(&p_catIdVar, "cat-id", "", "catId Category ID: Walmart category id, taken from a category URL (for example `976759_1086446_1229651`). Combine it with `q` to search inside a category, or send it alone to browse the whole category. Required unless `q` is provided.") + cmd.Flags().StringVar(&p_deliveryTypeVar, "delivery-type", "shipping", "deliveryType Delivery Type: Keep only the products available with the selected fulfillment method. Default is `shipping`. Note that `pickup` is answered against one Walmart store, so an item in stock nationally can still be unavailable for `pickup` nearby - the response then reports that nothing matched the filters rather than that the query had no results. [allowed: shipping|pickup]") + _ = cmd.RegisterFlagCompletionFunc("delivery-type", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"shipping", "pickup"}, cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().StringVar(&p_domainVar, "domain", "", "domain Domain: Walmart storefront to search. Each storefront has its own catalog, prices and currency. Default is `walmart.com`. [allowed: walmart.com|walmart.ca]") + _ = cmd.RegisterFlagCompletionFunc("domain", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"walmart.com", "walmart.ca"}, cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().StringVar(&p_facetVar, "facet", "brand:Great Value\nretailer_type:Walmart", "facet Facet Filter: Walmart filter in the `name:value` form, for example `brand:Great Value`. Every value available for a query is listed in the facets block of the response, each one carrying the exact string to send back here, so a first unfiltered request tells you what can be filtered on. To combine filters, put each one on its own line. The double-pipe form Walmart's own urls use `brand:Great Value||retailer_type:Walmart` is also accepted.") + cmd.Flags().StringVar(&p_languageVar, "language", "en", "language Language: Language of the results. Availability depends on the storefront - `walmart.com` serves `en` and `es`, `walmart.ca` serves `en` and `fr`. A language the storefront does not support falls back to its default. [allowed: en|es|fr]") + _ = cmd.RegisterFlagCompletionFunc("language", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"en", "es", "fr"}, cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().Float64Var(&p_maxPriceVar, "max-price", 0, "maxPrice Maximum Price: Upper bound of the price range, in the storefront currency.") + cmd.Flags().Float64Var(&p_minPriceVar, "min-price", 0, "minPrice Minimum Price: Lower bound of the price range, in the storefront currency.") + cmd.Flags().IntVar(&p_pageVar, "page", 0, "page Page Number: Page number for pagination (e.g., `1` for the first page, `2` for the second page, etc.). Walmart stops serving results after roughly page 10, returning an empty page beyond that.") + cmd.Flags().StringVar(&p_qVar, "q", "coffee", "q Search Query: The search term for which to get the search results. It can be omitted only when `catId` is provided, to browse a whole category instead of searching.") + cmd.Flags().StringVar(&p_sortVar, "sort", "bestMatch", "sort Sort By: The sorting option for the search results. [allowed: bestMatch|priceLowToHigh|priceHighToLow|bestseller|highlyRated|newArrivals]") + _ = cmd.RegisterFlagCompletionFunc("sort", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + return []string{"bestMatch", "priceLowToHigh", "priceHighToLow", "bestseller", "highlyRated", "newArrivals"}, cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().StringVar(&p_urlVar, "url", "", "url Search URL: A full Walmart search or category URL to scrape as is. When provided, it overrides `q`, `catId` and the other search parameters, and the storefront is taken from the URL itself.") + + return cmd +} + +func init() { + RegisterAPICommand("ecommerce", "E-commerce", newWalmartSearchCmd()) +} diff --git a/cmd/gen_yellowpages_place.go b/cmd/gen_yellowpages_place.go index 05f5b51..4466af7 100644 --- a/cmd/gen_yellowpages_place.go +++ b/cmd/gen_yellowpages_place.go @@ -23,8 +23,8 @@ func newYellowpagesPlaceCmd() *cobra.Command { cmd := &cobra.Command{ Use: "yellowpages-place", - Short: "YellowPages Place Scraper API (5 credits/call)", - Long: "The YellowPages Place Scraper API allows users to retrieve detailed information about a specific place using its YellowPages URL.\n\nEndpoint: GET https://api.hasdata.com/scrape/yellowpages/place\nCost: 5 credits per call.", + Short: "YellowPages Place Scraper API (10 credits/call)", + Long: "The YellowPages Place Scraper API allows users to retrieve detailed information about a specific place using its YellowPages URL.\n\nEndpoint: GET https://api.hasdata.com/scrape/yellowpages/place\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil diff --git a/cmd/gen_yellowpages_search.go b/cmd/gen_yellowpages_search.go index 007ee66..a403ed1 100644 --- a/cmd/gen_yellowpages_search.go +++ b/cmd/gen_yellowpages_search.go @@ -27,8 +27,8 @@ func newYellowpagesSearchCmd() *cobra.Command { cmd := &cobra.Command{ Use: "yellowpages-search", - Short: "YellowPages Search Scraper API (5 credits/call)", - Long: "The YellowPages Search Scraper API allows users to get results from the YellowPages search page. This API enables searching for businesses by keyword and location.\n\nEndpoint: GET https://api.hasdata.com/scrape/yellowpages/search\nCost: 5 credits per call.", + Short: "YellowPages Search Scraper API (10 credits/call)", + Long: "The YellowPages Search Scraper API allows users to get results from the YellowPages search page. This API enables searching for businesses by keyword and location.\n\nEndpoint: GET https://api.hasdata.com/scrape/yellowpages/search\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { if c.Flags().Changed("domain") { diff --git a/cmd/gen_zillow_listing.go b/cmd/gen_zillow_listing.go index 5c16be5..64d2e94 100644 --- a/cmd/gen_zillow_listing.go +++ b/cmd/gen_zillow_listing.go @@ -31,7 +31,6 @@ func newZillowListingCmd() *cobra.Command { var p_keywordVar string var p_keywordsVar string var p_listingPublishOptionsVar []string - var p_listingTypeVar string var p_lotSize_maxVar float64 var p_lotSize_minVar float64 var p_moveInDateVar string @@ -55,8 +54,8 @@ func newZillowListingCmd() *cobra.Command { cmd := &cobra.Command{ Use: "zillow-listing", - Short: "Zillow Listing Scraper API (5 credits/call)", - Long: "The Zillow Listing Scraper API lets you retrieve property listings from Zillow.com based on various search parameters.\n\nEndpoint: GET https://api.hasdata.com/scrape/zillow/listing\nCost: 5 credits per call.", + Short: "Zillow Listing Scraper API (10 credits/call)", + Long: "The Zillow Listing Scraper API lets you retrieve property listings from Zillow.com based on various search parameters.\n\nEndpoint: GET https://api.hasdata.com/scrape/zillow/listing\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { if c.Flags().Changed("basement") { @@ -79,11 +78,6 @@ func newZillowListingCmd() *cobra.Command { return err } } - if c.Flags().Changed("listing-type") { - if err := validateEnumString("listing-type", p_listingTypeVar, []string{"byAgent", "byOwner"}); err != nil { - return err - } - } if c.Flags().Changed("other-amenities") { if err := validateEnumStringSlice("other-amenities", p_otherAmenitiesVar, []string{"ac", "pool", "waterfront", "onsiteParking", "inUnitLaundry", "acceptZillowApplications", "incomeRestricted", "apartmentCommunity"}); err != nil { return err @@ -168,9 +162,6 @@ func newZillowListingCmd() *cobra.Command { params.Add("listingPublishOptions"+"[]", v) } } - if c.Flags().Changed("listing-type") { - params.Set("listingType", p_listingTypeVar) - } if c.Flags().Changed("lot-size-max") { params.Set("lotSize[max]", strconv.FormatFloat(p_lotSize_maxVar, 'f', -1, 64)) } @@ -267,17 +258,13 @@ func newZillowListingCmd() *cobra.Command { cmd.Flags().StringVar(&p_keywordVar, "keyword", "New York, NY", "keyword Location: The keyword used to search for listings. (required)") _ = cmd.MarkFlagRequired("keyword") cmd.Flags().StringVar(&p_keywordsVar, "keywords", "", "keywords Additional Keywords: Additional keywords to refine the search.") - cmd.Flags().StringSliceVar(&p_listingPublishOptionsVar, "listing-publish-options", nil, "listingPublishOptions[] Listing Publish Options: An array of listing publish options.") + cmd.Flags().StringSliceVar(&p_listingPublishOptionsVar, "listing-publish-options", nil, "listingPublishOptions[] Listing Publish Options: An array of listing publish options. Use `ownerPosted` for listings by owner and `agentListed` for listings by agent.") _ = cmd.RegisterFlagCompletionFunc("listing-publish-options", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { return []string{"ownerPosted", "agentListed", "newConstruction", "foreclosures", "auctions", "foreclosed", "preForeclosures"}, cobra.ShellCompDirectiveNoFileComp }) - cmd.Flags().StringVar(&p_listingTypeVar, "listing-type", "", "listingType Listing Category: The category of the listing. [allowed: byAgent|byOwner]") - _ = cmd.RegisterFlagCompletionFunc("listing-type", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { - return []string{"byAgent", "byOwner"}, cobra.ShellCompDirectiveNoFileComp - }) cmd.Flags().Float64Var(&p_lotSize_maxVar, "lot-size-max", 0, "lotSize[max] Lot Size Max: The maximum lot size.") cmd.Flags().Float64Var(&p_lotSize_minVar, "lot-size-min", 0, "lotSize[min] Lot Size Min: The minimum lot size.") - cmd.Flags().StringVar(&p_moveInDateVar, "move-in-date", "", "moveInDate Move In Date: The desired move-in date.") + cmd.Flags().StringVar(&p_moveInDateVar, "move-in-date", "", "moveInDate Move In Date: The desired move-in date in `YYYY-MM-DD` format.") cmd.Flags().BoolVar(&p_mustHaveGarageVar, "must-have-garage", false, "mustHaveGarage Must Have Garage: If set to true, only listings with a garage will be included.") cmd.Flags().StringSliceVar(&p_otherAmenitiesVar, "other-amenities", nil, "otherAmenities[] Other Amenities: An array of other amenities.") _ = cmd.RegisterFlagCompletionFunc("other-amenities", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { @@ -322,5 +309,5 @@ func newZillowListingCmd() *cobra.Command { } func init() { - RegisterAPICommand("zillow", "Zillow", newZillowListingCmd()) + RegisterAPICommand("real_estate", "Real Estate", newZillowListingCmd()) } diff --git a/cmd/gen_zillow_property.go b/cmd/gen_zillow_property.go index 54a19eb..ff3f35a 100644 --- a/cmd/gen_zillow_property.go +++ b/cmd/gen_zillow_property.go @@ -24,8 +24,8 @@ func newZillowPropertyCmd() *cobra.Command { cmd := &cobra.Command{ Use: "zillow-property", - Short: "Zillow Property Scraper API (5 credits/call)", - Long: "The Zillow Property Scraper API lets you retrieve detailed information about a specific property on Zillow.com using its URL. It provides details such as property features, price, and agent contacts.\n\nEndpoint: GET https://api.hasdata.com/scrape/zillow/property\nCost: 5 credits per call.", + Short: "Zillow Property Scraper API (10 credits/call)", + Long: "The Zillow Property Scraper API lets you retrieve detailed information about a specific property on Zillow.com using its URL. It provides details such as property features, price, and agent contacts.\n\nEndpoint: GET https://api.hasdata.com/scrape/zillow/property\nCost: 10 credits per call.", Args: cobra.NoArgs, PreRunE: func(c *cobra.Command, _ []string) error { return nil @@ -56,5 +56,5 @@ func newZillowPropertyCmd() *cobra.Command { } func init() { - RegisterAPICommand("zillow", "Zillow", newZillowPropertyCmd()) + RegisterAPICommand("real_estate", "Real Estate", newZillowPropertyCmd()) } diff --git a/internal/gen/spec-hash.txt b/internal/gen/spec-hash.txt index b519b34..92cb203 100644 --- a/internal/gen/spec-hash.txt +++ b/internal/gen/spec-hash.txt @@ -1 +1 @@ -e5451e3be6771c1b0f5ee61741d45e7b17312f9ffedcfba4369fd8c759b47d71 +945d952587eb073f24e009e3707f0a0337ac65d50d7c7d90b13d4d539c150f17 diff --git a/pr-body.md b/pr-body.md index 248a77e..2e76cf9 100644 --- a/pr-body.md +++ b/pr-body.md @@ -1,38 +1,56 @@ ## Changes - GENERATION_REPORT.md | 13 ++++-- - cmd/gen_airbnb_listing.go | 27 +++++++++-- - cmd/gen_bing_serp.go | 28 ++++++------ - cmd/gen_booking_place.go | 2 +- - cmd/gen_booking_search.go | 2 +- - cmd/gen_google_images.go | 2 +- - cmd/gen_google_immersive_product.go | 2 +- - cmd/gen_google_maps.go | 4 +- - cmd/gen_google_maps_reviews.go | 6 +-- - cmd/gen_google_news.go | 2 +- - cmd/gen_google_serp.go | 2 +- - cmd/gen_google_serp_light.go | 2 +- - cmd/gen_google_shopping.go | 2 +- - cmd/gen_instagram_profile.go | 2 +- - cmd/gen_redfin_listing.go | 2 +- - cmd/gen_web_scraping.go | 2 +- - internal/gen/spec-hash.txt | 2 +- - pr-body.md | 90 ------------------------------------- - 18 files changed, 65 insertions(+), 127 deletions(-) + GENERATION_REPORT.md | 31 +++++++---- + cmd/gen_airbnb_listing.go | 10 ++-- + cmd/gen_airbnb_property.go | 4 +- + cmd/gen_amazon_product.go | 8 +-- + cmd/gen_amazon_reviews.go | 6 +-- + cmd/gen_amazon_search.go | 6 +-- + cmd/gen_amazon_seller.go | 6 +-- + cmd/gen_amazon_seller_products.go | 6 +-- + cmd/gen_booking_place.go | 4 +- + cmd/gen_booking_search.go | 4 +- + cmd/gen_glassdoor_job.go | 4 +- + cmd/gen_glassdoor_listing.go | 56 ++++++++++++++++++-- + cmd/gen_google_ai_mode.go | 4 +- + cmd/gen_google_events.go | 55 +++---------------- + cmd/gen_google_flights.go | 4 +- + cmd/gen_google_hotels.go | 4 +- + cmd/gen_google_images.go | 4 +- + cmd/gen_google_immersive_product.go | 4 +- + cmd/gen_google_maps.go | 4 +- + cmd/gen_google_maps_contributor_reviews.go | 4 +- + cmd/gen_google_maps_photos.go | 4 +- + cmd/gen_google_maps_place.go | 9 +++- + cmd/gen_google_maps_posts.go | 5 -- + cmd/gen_google_maps_reviews.go | 4 +- + cmd/gen_google_short_videos.go | 9 +++- + cmd/gen_google_trends.go | 4 +- + cmd/gen_indeed_job.go | 4 +- + cmd/gen_indeed_listing.go | 4 +- + cmd/gen_instagram_posts.go | 4 +- + cmd/gen_instagram_profile.go | 4 +- + cmd/gen_redfin_listing.go | 6 +-- + cmd/gen_redfin_property.go | 6 +-- + cmd/gen_shopify_collections.go | 6 +-- + cmd/gen_shopify_products.go | 6 +-- + cmd/gen_yellowpages_place.go | 4 +- + cmd/gen_yellowpages_search.go | 4 +- + cmd/gen_zillow_listing.go | 23 ++------ + cmd/gen_zillow_property.go | 6 +-- + internal/gen/spec-hash.txt | 2 +- + pr-body.md | 84 ------------------------------ + 40 files changed, 175 insertions(+), 251 deletions(-) ## Generation Report # Generation Report -Generated at: 2026-08-31T07:13:05Z +Generated at: 2026-10-02T07:12:19Z -## APIs generated (55) +## APIs generated (64) +- chat-gpt-chat - airbnb-listing - airbnb-property -- amazon-product -- amazon-reviews -- amazon-search -- amazon-seller -- amazon-seller-products - bing-serp - booking-place - booking-search @@ -42,6 +60,16 @@ Generated at: 2026-08-31T07:13:05Z - yelp-reviews - yelp-search - duckduckgo +- amazon-product +- amazon-reviews +- amazon-search +- amazon-seller +- amazon-seller-products +- shopify-collections +- shopify-products +- walmart-product +- walmart-reviews +- walmart-search - google-images - google-maps - google-maps-contributor-reviews @@ -57,7 +85,10 @@ Generated at: 2026-08-31T07:13:05Z - google-serp-light - google-shopping - google-short-videos +- google-scholar +- google-scholar-cite - google-flights +- google-flights-deals - google-hotels - google-trends - glassdoor-job @@ -66,8 +97,10 @@ Generated at: 2026-08-31T07:13:05Z - indeed-listing - redfin-listing - redfin-property -- shopify-collections -- shopify-products +- zillow-listing +- zillow-property +- facebook-profile +- instagram-comments - instagram-posts - instagram-profile - tiktok-comments @@ -79,8 +112,6 @@ Generated at: 2026-08-31T07:13:05Z - youtube-search-api - youtube-transcript-api - youtube-video-api -- zillow-listing -- zillow-property ## Deprecated APIs (hidden in help) - amazon-reviews