Add True Shot Ammo (Shopify JSON), Palmetto State Armory (Magento HTML), Bulk Ammo (Magento HTML), and Natchez Shooters Supply (GraphQL API). Extends scraper infrastructure with HttpClient.post_json/3 and an optional fetch/2 callback on the Scraper behaviour for scrapers that need custom HTTP flows (e.g. GraphQL POST requests).
10 lines
350 B
Elixir
10 lines
350 B
Elixir
defmodule Ammoprices.Scraping.Scraper do
|
|
@moduledoc false
|
|
|
|
@callback retailer_slug() :: String.t()
|
|
@callback category_url(caliber :: map()) :: String.t() | nil
|
|
@callback parse_products(html :: term()) :: [map()]
|
|
@callback fetch(retailer :: map(), caliber :: map()) :: {:ok, [map()]} | {:error, term()}
|
|
|
|
@optional_callbacks [fetch: 2]
|
|
end
|