Documentation
¶
Overview ¶
Package parser implements the w_popularity instagram adapter.
Strategy:
primary: best-effort public HTML scrape — Instagram serves a meta
description like "46 Followers, 226 Following, 7 Posts - …"
on public profiles, even without cookies. We regex those
three numbers out of the og:description / description meta.
fallback: camoufox via CDP (skeleton only — not yet wired). In
production Instagram aggressively blocks logged-out HTTP
scraping; the realistic primary path is camoufox + cookies.
FetchRecentPosts returns (nil, nil) on the logged-out path because Instagram blocks media listings for guests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// HTTPTimeout caps every outbound call. Defaults to 15s.
HTTPTimeout time.Duration
// UserAgent overrides the default UA string used for HTML requests.
UserAgent string
// CamoufoxURL is the CDP endpoint of a running camoufox instance
// (e.g. "http://camoufox:3000"). When empty, the camoufox fallback
// is disabled and ErrAuth is returned for logged-out walls.
CamoufoxURL string
// HTTPClient overrides the default *http.Client. Mainly useful in tests
// for routing requests to an httptest.Server.
HTTPClient *http.Client
// BaseURL overrides https://www.instagram.com. Test hook.
BaseURL string
}
Config controls runtime behaviour.
type InstagramParser ¶
type InstagramParser struct {
// contains filtered or unexported fields
}
InstagramParser is the shared.Parser implementation for Instagram.
func (*InstagramParser) FetchChannel ¶
func (p *InstagramParser) FetchChannel(ctx context.Context, handle string) (shared.ChannelSnapshot, error)
FetchChannel attempts the public-HTML primary path, then falls back to the camoufox skeleton if configured.
func (*InstagramParser) FetchRecentPosts ¶
func (p *InstagramParser) FetchRecentPosts(ctx context.Context, handle string, since time.Time) ([]shared.PostSnapshot, error)
FetchRecentPosts returns (nil, nil) for the logged-out path — Instagram blocks media listings for guests.
func (*InstagramParser) Platform ¶
func (p *InstagramParser) Platform() shared.Platform
Platform returns shared.PlatformInstagram.
Click to show internal directories.
Click to hide internal directories.