arXiv Python API Wrapper

2.4.1 · active · verified Thu Apr 02

The `arxiv` library is a Python wrapper for the arXiv API, providing programmatic access to over a million scholarly articles in physics, mathematics, computer science, and other fields. It allows users to search, retrieve metadata, and download papers from the arXiv open-access repository. The library is actively maintained with frequent minor and patch releases.

Warnings

Install

Imports

Quickstart

This example demonstrates how to initialize the API client, perform a search for articles, and iterate through the results to print their titles, authors, and publication dates.

import arxiv

# Construct the default API client
client = arxiv.Client()

# Search for the 10 most recent articles matching 'quantum'
search = arxiv.Search(
  query = "quantum",
  max_results = 10,
  sort_by = arxiv.SortCriterion.SubmittedDate,
  sort_order = arxiv.SortOrder.Descending
)

for result in client.results(search):
  print(f"Title: {result.title}")
  print(f"Authors: {', '.join(author.name for author in result.authors)}")
  print(f"Published: {result.published}")
  # Example: download PDF to current directory (note deprecation warning in v2.3.0)
  # result.download_pdf(dirpath='./downloads')

view raw JSON →