Documentation
¶
Overview ¶
Package snapchat is the library behind the snap command line: the HTTP client, block detection, and the typed data models for story.snapchat.com and www.snapchat.com.
Snapchat is Tier C (anti-bot). Requests from datacenter IPs usually receive a Cloudflare challenge page (HTTP 403 or 200 with a JS interstitial) instead of real data. The client detects all known block patterns and returns errs.Blocked so callers can exit with code 5.
Index ¶
Constants ¶
const ( Host = "snapchat.com" BaseURL = "https://www.snapchat.com" StoryBase = "https://story.snapchat.com" )
Host and base URLs.
const DefaultUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) " +
"AppleWebKit/537.36 (KHTML, like Gecko) " +
"Chrome/124.0.0.0 Safari/537.36"
DefaultUserAgent mimics a real desktop Chrome browser on macOS.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a rate-limited HTTP client for Snapchat public endpoints.
type Config ¶
type Config struct {
BaseURL string
StoryBase string
UserAgent string
Rate time.Duration
Retries int
Timeout time.Duration
}
Config holds tunable parameters for Client.
type Domain ¶
type Domain struct{}
Domain is the Snapchat driver.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, hostnames, and binary identity.
type SpotlightVideo ¶
type SpotlightVideo struct {
ID string `json:"id"`
Title string `json:"title"`
Author string `json:"author"`
ViewCount int64 `json:"view_count"`
DurationS int `json:"duration_s"`
Thumbnail string `json:"thumbnail"`
URL string `json:"url"`
}
SpotlightVideo is one trending Spotlight video record.