Documentation
¶
Overview ¶
Package parser implements the w_popularity GitHub adapter.
Strategy: GitHub REST API v3 (https://api.github.com).
- GET /users/<handle> → followers, following, public_repos, ...
- GET /users/<handle>/repos?... → owned repos with stargazers_count, forks etc.
- GET /users/<handle>/events/public?per_page=50 → recent activity (pushes, creates, releases) used as "posts" surrogate.
Anonymous quota: 60 req/hour per IP. Authenticated (Config.Token): 5000/hour. We optimise for 1 fetch per channel per day → anonymous is fine for a handful of channels.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Token is an optional GitHub personal access token (PAT) or fine-grained
// token. When set, bumps the rate limit from 60 → 5000 req/hour. The
// parser only reads public data so `public_repo` scope is plenty (none is
// needed for fully public reads).
Token string
HTTPClient *http.Client
HTTPTimeout time.Duration
UserAgent string
BaseURL string // overrides https://api.github.com (test hook)
// TopReposMinStars is the threshold below which repos are NOT included in
// the per-snapshot `Raw["top_repos"]` summary list. Stars-based filtering
// keeps the snapshot lean for users with hundreds of small repos.
// Default: 5.
TopReposMinStars int
// MaxReposPage caps the per-page repo listing. Default 100 (the GitHub
// max). We fetch a single page; users with >100 repos lose tail data,
// which is fine for the "top repos by stars" use case.
MaxReposPage int
}
Config controls runtime behaviour.
type GitHubParser ¶
type GitHubParser struct {
// contains filtered or unexported fields
}
func New ¶
func New(cfg Config) *GitHubParser
func (*GitHubParser) FetchChannel ¶
func (p *GitHubParser) FetchChannel(ctx context.Context, handle string) (shared.ChannelSnapshot, error)
FetchChannel returns one snapshot per call: profile counts + an aggregate of owned repos. We assemble `Raw["top_repos"]` (repos with stars ≥ TopReposMinStars, sorted desc by stars, capped at 20) and per-language / per-topic histograms.
func (*GitHubParser) FetchRecentPosts ¶
func (p *GitHubParser) FetchRecentPosts(ctx context.Context, handle string, since time.Time) ([]shared.PostSnapshot, error)
func (*GitHubParser) Platform ¶
func (p *GitHubParser) Platform() shared.Platform
Click to show internal directories.
Click to hide internal directories.