audioarxiv.resources.paper.Paper

class audioarxiv.resources.paper.Paper(page_size: int = 100, delay_seconds: float = 3.0, num_retries: int = 3, validate_arguments: bool = True)[source]

Bases: object

A class to fetch papers from arXiv.

Methods

__init__([page_size, delay_seconds, ...])

An arXiv paper.

download_pdf([dirpath, filename])

Download the PDF.

search_by_arxiv_id(arxiv_id)

Search paper by arXiv ID.

Attributes

abstract

Abstract.

authors

List of authors.

client

Get the arxiv client.

published

Published date.

sections

Get the sections of the paper.

title

Title of the paper.

updated

Updated date.

__init__(page_size: int = 100, delay_seconds: float = 3.0, num_retries: int = 3, validate_arguments: bool = True)[source]

An arXiv paper.

Parameters:
  • page_size (int, optional) – Maximum number of results fetched in a single API request. Smaller pages can be retrieved faster, but may require more round-trips. The API’s limit is 2000 results per page. Defaults to 100.

  • delay_seconds (float, optional) – Number of seconds to wait between API requests. arXiv’s Terms of Use ask that you “make no more than one request every three seconds.” Defaults to 3.0.

  • num_retries (int, optional) – Number of times to retry a failing API request before raising an Exception. Defaults to 3.

  • validate_arguments (bool, optional) – If True, validate the arguments. Defaults to True.

property abstract: str | None

Abstract.

Returns:

Abstract. None if paper is None.

Return type:

str | None

property authors: list | None

List of authors.

Returns:

List of authors. None if paper is None.

Return type:

list | None

property client: Client

Get the arxiv client.

Returns:

arxiv client.

Return type:

arxiv.Client

download_pdf(dirpath: str = './', filename: str = '') str | None[source]

Download the PDF.

Parameters:
  • dirpath (str, optional) – Path to the directory. Defaults to ‘./’.

  • filename (str, optional) – Name of the file. Defaults to ‘’.

Returns:

Path of the output PDF. None if paper is None.

Return type:

str | None

property published: datetime | None

Published date.

Returns:

Published date. None if paper is None.

Return type:

datetime

search_by_arxiv_id(arxiv_id: str)[source]

Search paper by arXiv ID.

Parameters:

arxiv_id (str) – arXiv ID.

property sections: list

Get the sections of the paper.

Returns:

A list of sections. Each section is a dict with the header as the key and the content as the value.

Return type:

list

property title: str | None

Title of the paper.

Returns:

Title of the paper. None if paper is None.

Return type:

str | None

property updated: datetime | None

Updated date.

Returns:

Updated date. None if paper is None.

Return type:

datetime | None