scraper

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCategoryProducts added in v0.0.3

func ParseCategoryProducts(reader io.Reader) ([]types.Product, []types.CategoryLink, error)

ParseCategoryProducts parses a Product Hunt category page (e.g. /categories/ai-agents) and extracts the product list plus related category links.

func ParseLeaderboard

func ParseLeaderboard(reader io.Reader) ([]types.Product, error)

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.

func ParseSearchResults added in v0.0.2

func ParseSearchResults(reader io.Reader) ([]types.Product, error)

ParseSearchResults parses Product Hunt search HTML. Search page markup differs from leaderboard markup, so parse with broader selectors anchored to main content.

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) ClearCache

func (s *Scraper) ClearCache()

ClearCache clears the in-memory cache.

func (*Scraper) GetCategoryProducts added in v0.0.3

func (s *Scraper) GetCategoryProducts(slug string) ([]types.Product, []types.CategoryLink, error)

GetCategoryProducts fetches and parses a Product Hunt category page.

func (*Scraper) GetLeaderboard

func (s *Scraper) GetLeaderboard(period types.Period, date time.Time) ([]types.Product, error)

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

func (s *Scraper) SearchProducts(query string) ([]types.Product, error)

SearchProducts fetches Product Hunt global search results for the query.

func (*Scraper) SearchProductsPage added in v0.0.2

func (s *Scraper) SearchProductsPage(query string, page int) ([]types.Product, int, bool, bool, int, error)

SearchProductsPage fetches a single search results page and paging metadata.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL