Documentation
¶
Overview ¶
Package csdn is the library behind the csdn command: the HTTP client, request shaping, and the typed data models for CSDN (csdn.net).
The Client hits two public CSDN endpoints:
- so.csdn.net/api/v3/search — full-text search across blog posts
- blog.csdn.net/phoenix/web/blog/hot-rank — hourly hot article ranking
No authentication is required. It sets a real User-Agent, paces requests, and retries transient 429/5xx errors with exponential backoff.
Index ¶
Constants ¶
View Source
const DefaultUserAgent = "csdn/dev (+https://github.com/tamnd/csdn-cli)"
DefaultUserAgent identifies the client to CSDN.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct {
Rank int `json:"rank"`
Title string `json:"title"`
Author string `json:"author"`
Views string `json:"views"`
Comments string `json:"comments"`
Collections string `json:"collections"`
Date string `json:"date"`
URL string `json:"url"`
}
Article is the record emitted for search results.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the CSDN public APIs.
type Config ¶
type Config struct {
BaseURL string // search base: https://so.csdn.net
HotBaseURL string // hot rank base: https://blog.csdn.net
UserAgent string
Rate time.Duration
Retries int
Timeout time.Duration
}
Config holds constructor parameters for Client.
type HotArticle ¶
type HotArticle struct {
Rank int `json:"rank"`
Score string `json:"score"`
Title string `json:"title"`
Author string `json:"author"`
Views string `json:"views"`
Comments string `json:"comments"`
Favorites string `json:"favorites"`
URL string `json:"url"`
}
HotArticle is the record emitted for hot-rank results.
Click to show internal directories.
Click to hide internal directories.