/pyanilist

A Python wrapper for the AniList API

Primary LanguagePythonMIT LicenseMIT


Logo

Simple AniList API wrapper to fetch media data

PyPI - Version PyPI - Python Version License Checked with mypy Ruff

GitHub Workflow Status (with event) GitHub Actions Workflow Status codecov

Table Of Contents

About

  • Supports both sync and async.
  • Provides easy access to almost every field present in AniList's Media type.
  • Only supports querying the Media type

Installation

pyanilist is available on PyPI, so you can simply use pip to install it.

pip install pyanilist

Usage

  1. AniList() - Synchronous class

    • search() - Search a media

      from pyanilist import AniList, MediaType
      
      media = AniList().search("Attack on Titan", type=MediaType.ANIME)
      
      print(media.title.romaji)
      """
      Shingeki no Kyojin
      """
      print(media.site_url)
      """
      https://anilist.co/anime/16498
      """
      print(media.episodes)
      """
      25
      """
    • get() - Get a media by it's AniList ID

      from pyanilist import AniList
      
      media = AniList().get(21459)
      
      print(media.title.english)
      """
      My Hero Academia
      """
      print(media.site_url)
      """
      https://anilist.co/anime/21459
      """
      print(media.episodes)
      """
      13
      """
  2. AsyncAniList() - Asynchronous class

    • search() - Search a media

      import asyncio
      from pyanilist import AsyncAniList, MediaType
      
      media = asyncio.run(AsyncAniList().search("Attack on Titan", type=MediaType.ANIME))
      
      print(media.title.romaji)
      """
      Shingeki no Kyojin
      """
      print(media.site_url)
      """
      https://anilist.co/anime/16498
      """
      print(media.episodes)
      """
      25
      """
    • get() - Get a media by it's AniList ID

      import asyncio
      from pyanilist import AsyncAniList
      
      media = asyncio.run(AsyncAniList().get(21459))
      
      print(media.title.english)
      """
      My Hero Academia
      """
      print(media.site_url)
      """
      https://anilist.co/anime/21459
      """
      print(media.episodes)
      """
      13
      """

Docs

Checkout the complete documentation here.

License

Distributed under the Unlicense License. See UNLICENSE for more information.