Documentation
¶
Overview ¶
Package parser implements the w_popularity Habr adapter using public HTML, RSS and Habr's own JSON endpoints (the same ones habr.com uses).
Endpoints used (all GET, JSON unless noted):
- /kek/v2/users/<handle>/card user profile counters
- /kek/v2/articles/?user=<h>&perPage=20&order=date author article list
- /ru/users/<handle>/ HTML fallback for card
- /ru/rss/users/<handle>/publications/articles/ RSS fallback for posts
Strategy:
primary: Habr public JSON API (no auth required) fallback: HTML scrape + RSS feed
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
HTTPClient *http.Client
HTTPTimeout time.Duration
// UserAgent overrides the default browser-ish UA. Habr 403s requests
// with an empty UA.
UserAgent string
}
Config controls runtime behaviour.
type HabrParser ¶
type HabrParser struct {
// contains filtered or unexported fields
}
func New ¶
func New(cfg Config) *HabrParser
func (*HabrParser) FetchChannel ¶
func (p *HabrParser) FetchChannel(ctx context.Context, handle string) (shared.ChannelSnapshot, error)
func (*HabrParser) FetchRecentPosts ¶
func (p *HabrParser) FetchRecentPosts(ctx context.Context, handle string, since time.Time) ([]shared.PostSnapshot, error)
func (*HabrParser) Platform ¶
func (p *HabrParser) Platform() shared.Platform
Click to show internal directories.
Click to hide internal directories.