5 releases (stable)

1.1.2 Jan 3, 2025
1.1.1 Jan 1, 2025
1.1.0 Dec 29, 2024
1.0.0 Dec 27, 2024
0.1.0 Dec 13, 2024

#674 in Web programming

Download history 117/week @ 2024-12-10 9/week @ 2024-12-17 265/week @ 2024-12-24 305/week @ 2024-12-31 11/week @ 2025-01-07

597 downloads per month

Apache-2.0

27KB
557 lines

Crates.io Version

arxiv-tools

Tools for arXiv API.

LOGO

Quick Start

Installation

To start using arxiv-tools, just add it to your project's dependencies in the Cargo.toml.

> cargo add arxiv-tools

Then, import it in your program.

use arxiv_tools::ArXiv;

Usage

See the Documents.

Release Notes

1.1.2
  • Fixed a bug: fixed the query parameter submittedDate.
1.1.0
  • Added optional parameters such as start, max_results, sortBy, sortOrder.
  • Updated documents.

lib.rs:

Description

This library provides a simple interface to query the arXiv API.

Example

Simple Query

// get arxiv object from query parameters
let mut arxiv = ArXiv::from_args(QueryParams::title("attention is all you need"));

// execute
let response: Vec<Paper> = arxiv.query().await;

//verify
let paper = response.first().unwrap();
assert!(paper.title.to_lowercase().contains("attention is all you need"));

Complex Query

// build query parameters
let args = QueryParams::and(vec![
    QueryParams::or(vec![QueryParams::title("ai"), QueryParams::title("llm")]),
    QueryParams::group(vec![QueryParams::or(vec![
        QueryParams::subject_category(Category::CsAi),
        QueryParams::subject_category(Category::CsLg),
    ])]),
    QueryParams::SubmittedDate(String::from("202412010000"), String::from("202412012359")),
]);
let mut arxiv = ArXiv::from_args(args);

// set additional parameters
arxiv.start(10);
arxiv.max_results(100);
arxiv.sort_by(SortBy::SubmittedDate);
arxiv.sort_order(SortOrder::Ascending);

// execute
let response = arxiv.query().await;

// verify
assert!(response.len() > 0);

Dependencies

~11–23MB
~316K SLoC