Documentation
¶
Index ¶
- func ParseCategoryProducts(reader io.Reader) ([]types.Product, []types.CategoryLink, error)
- func ParseLeaderboard(reader io.Reader) ([]types.Product, error)
- func ParseProductDetail(reader io.Reader) (types.ProductDetail, error)
- func ParseSearchResults(reader io.Reader) ([]types.Product, error)
- type Scraper
- func (s *Scraper) ClearCache()
- func (s *Scraper) GetCategoryProducts(slug string) ([]types.Product, []types.CategoryLink, error)
- func (s *Scraper) GetLeaderboard(period types.Period, date time.Time) ([]types.Product, error)
- func (s *Scraper) GetProductDetail(slug string) (types.ProductDetail, error)
- func (s *Scraper) SearchProducts(query string) ([]types.Product, error)
- func (s *Scraper) SearchProductsPage(query string, page int) ([]types.Product, int, bool, bool, int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseCategoryProducts ¶ added in v0.0.3
ParseCategoryProducts parses a Product Hunt category page (e.g. /categories/ai-agents) and extracts the product list plus related category links.
func ParseLeaderboard ¶
ParseLeaderboard parses Product Hunt leaderboard HTML and returns a slice of Products. It expects SSR HTML from Product Hunt's Next.js pages.
func ParseProductDetail ¶
func ParseProductDetail(reader io.Reader) (types.ProductDetail, error)
ParseProductDetail parses a Product Hunt product detail page and extracts product information from the rendered HTML.
Types ¶
type Scraper ¶
type Scraper struct {
// contains filtered or unexported fields
}
Scraper implements types.ProductSource using HTTP client and in-memory cache.
func New ¶
func New() *Scraper
New creates a new Scraper with configured HTTP client and empty cache.
func (*Scraper) GetCategoryProducts ¶ added in v0.0.3
GetCategoryProducts fetches and parses a Product Hunt category page.
func (*Scraper) GetLeaderboard ¶
GetLeaderboard fetches and parses the Product Hunt Featured leaderboard for the given period and date.
func (*Scraper) GetProductDetail ¶
func (s *Scraper) GetProductDetail(slug string) (types.ProductDetail, error)
GetProductDetail fetches and parses the Product Hunt product detail page for the given slug.
func (*Scraper) SearchProducts ¶ added in v0.0.2
SearchProducts fetches Product Hunt global search results for the query.