Documentation
¶
Overview ¶
Package arxiv is the library behind the arxiv command: the HTTP client, request shaping, and the typed data models for the arXiv Open Access API.
The API endpoint is https://export.arxiv.org/api/query. It returns Atom XML and requires no key. The arXiv ToS recommends no more than 3 requests per second; the default rate is 400 ms between calls.
Index ¶
Constants ¶
const DefaultUserAgent = "arxiv/dev (+https://github.com/tamnd/arxiv-cli)"
DefaultUserAgent identifies the client to arXiv.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when the API returns an empty entry list for a given id.
Functions ¶
func ParsePaperID ¶
ParsePaperID extracts a bare arXiv id (e.g. "1706.03762") from:
- a bare new-style id: "1706.03762"
- a versioned id: "1706.03762v7"
- a legacy id: "hep-th/9705158"
- a full URL: "https://arxiv.org/abs/1706.03762v7"
- an export URL: "https://export.arxiv.org/abs/1706.03762"
The version suffix is always stripped. Returns an error if s does not look like any recognized arXiv id form.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the arXiv Open Access API.
func (*Client) Paper ¶
Paper fetches the single paper with the given id (version suffix stripped). Returns ErrNotFound if the id produces an empty result.
type Paper ¶
type Paper struct {
ID string `json:"id"`
Title string `json:"title"`
Authors []string `json:"authors"`
Category string `json:"category"`
Published string `json:"published"`
Updated string `json:"updated"`
Summary string `json:"summary"`
URL string `json:"url"`
PDF string `json:"pdf"`
}
Paper is the canonical record emitted for every search, paper, and author result. JSON keys are stable.