Use ingest_paper to fetch, parse, and serialize an arXiv paper into Markdown within an async context.
Parameters:
arxiv_id (str): The arXiv ID (e.g., '2501.11120v1') or URL (e.g., 'https://arxiv.org/abs/2501.11120').remove_refs (bool): If True, removes the bibliography/references sections. Defaults to True.remove_toc (bool): If True, removes the table of contents. Defaults to True.remove_inline_citations (bool): If True, removes inline citation text. Defaults to True.section_filter_mode (Literal['include', 'exclude']): Determines how the sections list is applied. Defaults to 'exclude'.sections (list[str] | None): A list of section titles. If section_filter_mode is 'include', only these sections are kept. If 'exclude', these sections are removed. Defaults to None (all sections).include_frontmatter (bool): If True, prepends YAML frontmatter containing paper metadata. Defaults to False.
Returns:
An IngestionResult object containing .content (Markdown), .summary, .sections_tree, and .frontmatter.
import asyncio
from arxiv2md import ingest_paper
async def main():
result = await ingest_paper(
"2501.11120",
remove_refs=True,
include_frontmatter=True,
section_filter_mode="include",
sections=["Introduction", "Conclusion"]
)
print(result.content)
asyncio.run(main())