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.
const Host = "arxiv.org"
Host is the arXiv site this client represents.
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 Domain ¶ added in v0.1.1
type Domain struct{}
Domain is the arxiv kit driver. It carries no state; the per-run Client is built by the factory Register hands kit.
func (Domain) Info ¶ added in v0.1.1
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type Paper ¶
type Paper struct {
ID string `json:"id" kit:"id" table:"id"`
Title string `json:"title" table:"title"`
Authors []string `json:"authors" table:"authors"`
Category string `json:"category" table:"category"`
Published string `json:"published" table:"date"`
Updated string `json:"updated" table:"-"`
Summary string `json:"summary" table:"-"`
URL string `json:"url" table:"abs,url"`
PDF string `json:"pdf" table:"pdf,url"`
}
Paper is the canonical record emitted for every search, paper, and author result. JSON keys are stable.