Git Product home page Git Product logo

animethemes-api's Introduction

Update

AnimeThemes has an official API https://staging.animethemes.moe/ and audio only mode is planned.

I will keep updating this whenever I can. I'll probably end up switching to a proper database again and do automatic updates.

AnimeThemes unofficial API

This an AnimeThemes API written in Python. It works by scraping data from the subreddit (r/AnimeThemes) and saving it to different JSON files under 'data' folder. This is done by the scraping script that is present in the code.

The API is deployed in Heroku and is powered by Flask.

End-points

Get anime's info

/api/v1/anime/:anime_id

Returns info related to an anime that is identified by the 'anime_id' (MyAnimeList anime's ID).

Example output:

/api/v1/anime/40060

{
  "mal_id": 40060,
  "title": ["BNA", "Brand New Animal"],
  "cover": "https://cdn.myanimelist.net/images/anime/1139/106986.jpg",
  "year": 2020,
  "season": "Spring 2020",
  "themes": [
    {
      "title": "Ready to",
      "theme_id": "40060-00",
      "type": "OP V1",
      "artist": null,
      "mirrors": [
        {
          "quality": "",
          "mirror": "https://animethemes.moe/video/BrandNewAnimal-OP1.webm",
          "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/40060-00/0/audio"
        }
      ],
      "notes": "",
      "episodes": "1-5",
      "category": ""
    },
    {
      "title": "Ready to",
      "theme_id": "40060-01",
      "type": "OP V2",
      "artist": null,
      "mirrors": [
        {
          "quality": "",
          "mirror": "https://animethemes.moe/video/BrandNewAnimal-OP1v2.webm",
          "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/40060-01/0/audio"
        }
      ],
      "notes": "",
      "episodes": "6-11",
      "category": ""
    },
    {
      "title": "NIGHT RUNNING",
      "theme_id": "40060-02",
      "type": "ED V1",
      "artist": null,
      "mirrors": [
        {
          "quality": "",
          "mirror": "https://animethemes.moe/video/BrandNewAnimal-ED1.webm",
          "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/40060-02/0/audio"
        }
      ],
      "notes": "",
      "episodes": "1-6",
      "category": ""
    },
    {
      "title": "NIGHT RUNNING",
      "theme_id": "40060-03",
      "type": "ED V2",
      "artist": null,
      "mirrors": [
        {
          "quality": "",
          "mirror": "https://animethemes.moe/video/BrandNewAnimal-ED1v2.webm",
          "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/40060-03/0/audio"
        }
      ],
      "notes": "",
      "episodes": "7-10",
      "category": ""
    },
    {
      "title": "NIGHT RUNNING",
      "theme_id": "40060-04",
      "type": "ED V3",
      "artist": null,
      "mirrors": [
        {
          "quality": "",
          "mirror": "https://animethemes.moe/video/BrandNewAnimal-ED1v3.webm",
          "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/40060-04/0/audio"
        }
      ],
      "notes": "",
      "episodes": "11",
      "category": ""
    }
  ]
}

Get artist's info

/api/v1/artist/:artist_id

Returns info related to an artist that is identified by the 'artist_id' (MyAnimeList people's ID).

Example output (truncated):

/api/v1/artist/10561

{
  "artist_id": 10561,
  "name": "LiSA",
  "cover": "https://cdn.myanimelist.net/images/voiceactors/2/36293.jpg",
  "themes": [
    {
      "mal_id": 6547,
      "title": "Angel Beats!",
      "cover": "https://cdn.myanimelist.net/images/anime/10/22061.jpg",
      "year": 2010,
      "season": "Spring 2010",
      "themes": [
        {
          "title": "My Soul, Your Beats!",
          "theme_id": "6547-01",
          "type": "OP2",
          "artist": "LiSA",
          "mirrors": [
            {
              "quality": "BD, 1080",
              "mirror": "https://animethemes.moe/video/AngelBeats-OP2.webm",
              "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/6547-01/0/audio"
            }
          ],
          "notes": "",
          "episodes": "4",
          "category": ""
        },
        {
          "title": "Ichiban no Takaramono ~Yui final ver.~",
          "theme_id": "6547-03",
          "type": "ED2",
          "artist": "LiSA",
          "mirrors": [
            {
              "quality": "Over",
              "mirror": "https://animethemes.moe/video/AngelBeats-ED2.webm",
              "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/6547-03/0/audio"
            }
          ],
          "notes": "Spoiler",
          "episodes": "10",
          "category": ""
        }
      ]
    }
  ]
}

Get theme's info

/api/v1/theme/:theme_id

Returns info related to a theme that is identified by the 'theme_id' (format: 'anime_id'-index).

Example output:

/api/v1/theme/40060-00

{
  "title": "Ready to",
  "theme_id": "40060-00",
  "type": "OP V1",
  "artist": null,
  "mirrors": [
    {
      "quality": "",
      "mirror": "https://animethemes.moe/video/BrandNewAnimal-OP1.webm",
      "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/40060-00/0/audio"
    }
  ],
  "notes": "",
  "episodes": "1-5",
  "category": ""
}

Search content in the data base

/api/v1/search/:search

Returns a dict containing list of anime, artists and themes.

Example output (truncated):

/api/v1/search/night

{
  "anime": [
    {
      "mal_id": 3024,
      "title": ["Ribbon no Kishi", "Princess Knight"],
      "cover": "https://cdn.myanimelist.net/images/anime/2/4403.jpg",
      "year": 60,
      "season": "All 60s",
      "themes": [
        {
          "title": "Ribbon No Kishi",
          "theme_id": "3024-00",
          "type": "OP",
          "artist": null,
          "mirrors": [
            {
              "quality": "DVD, 480",
              "mirror": "https://animethemes.moe/video/RibbonNoKishi-OP1.webm",
              "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/3024-00/0/audio"
            }
          ],
          "notes": "",
          "episodes": "",
          "category": ""
        },
        {
          "title": "Ribbon No March",
          "theme_id": "3024-01",
          "type": "ED",
          "artist": null,
          "mirrors": [
            {
              "quality": "DVD, 480",
              "mirror": "https://animethemes.moe/video/RibbonNoKishi-ED1.webm",
              "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/3024-01/0/audio"
            }
          ],
          "notes": "",
          "episodes": "",
          "category": ""
        }
      ]
    }
  ],
  "themes": [
    {
      "title": "Space Knights no Uta",
      "theme_id": "1458-01",
      "type": "ED",
      "artist": null,
      "mirrors": [
        {
          "quality": "480",
          "mirror": "https://animethemes.moe/video/UchuuNoKishiTekkaman-ED1.webm",
          "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/1458-01/0/audio"
        }
      ],
      "notes": "",
      "episodes": "",
      "category": ""
    }
  ],
  "artist": [
    {
      "artist_id": 6201,
      "name": "Nightmare",
      "cover": "https://cdn.myanimelist.net/images/voiceactors/1/44467.jpg",
      "themes": [
        {
          "mal_id": 1818,
          "title": "Claymore",
          "cover": "https://cdn.myanimelist.net/images/anime/3/21834.jpg",
          "year": 2007,
          "season": "Spring 2007",
          "themes": [
            {
              "title": "Raison D'être",
              "theme_id": "1818-00",
              "type": "OP",
              "artist": "Nightmare",
              "mirrors": [
                {
                  "quality": "NC, BD",
                  "mirror": "https://animethemes.moe/video/Claymore-OP1.webm",
                  "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/1818-00/0/audio"
                }
              ],
              "notes": "",
              "episodes": "",
              "category": ""
            }
          ]
        }
      ]
    }
  ]
}

/api/v1/search/anime/:search

Returns a dict containing list of anime.

/api/v1/search/artist/:search

Returns a dict containing list of artists.

/api/v1/search/theme/:search

Returns a dict containing list of themes.

Get video mirror (redirect)

/api/v1/theme/:theme_id/video

/api/v1/theme/:theme_id/:quality/video

Redirects to the requested mirror of a theme identified by 'theme_id'. 'quality' is the index of the desired mirror for that quality. Check theme's info for a list of mirrors.

/api/v1/theme/35062-00/1/video

Example output:

Redirection to https://animethemes.moe/video/MahoutsukaiNoYome-OP1-Lyrics.webm

Extract audio from video

/api/v1/theme/:theme_id/audio

/api/v1/theme/:theme_id/:quality/audio

Extracts the audio from the video file of the theme identified by 'theme_id' and uploads to ephemeral file system server (temporal storage). Then, it redirects to the download link.

Get list of years, seasons, current season and all seasons

/api/v1/season/all

Return a list of all years with their available seasons.

Example output (truncated):

{
  "2000": ["Winter", "Spring", "Summer", "Fall"],
  "2020": ["Winter", "Spring", "Summer", "Fall"]
}

/api/v1/season/years

Return a list of all years available.

Example output:

[
  60, 70, 80, 90, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
  2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020
]

/api/v1/season/current

Return a list of all anime of the current year season.

Example output (truncated):

[
  {
    "anime_id": 41380,
    "title": "100-man no Inochi no Ue ni Ore wa Tatteiru | I'm Standing on a Million Lives",
    "cover": "https://cdn.myanimelist.net/images/anime/1825/108800.jpg",
    "year": "2020",
    "season": "Fall 2020",
    "themes": ["41380-00", "41380-01", "41380-02"],
    "__type__": "Anime"
  }
]

/api/v1/season/:year

Return a list of all anime of the year divided by seasons.

Example output (truncated):

/api/v1/season/2019

{
  "year": 2019,
  "seasons": [
    {
      "season": "Winter",
      "anime": [
        {
          "mal_id": 37956,
          "title": ["3D Kanojo: Real Girl 2nd Season"],
          "cover": "https://cdn.myanimelist.net/images/anime/1941/97219.jpg",
          "year": 2019,
          "season": "Winter 2019",
          "themes": [
            {
              "title": "Futari nara",
              "theme_id": "37956-00",
              "type": "OP",
              "artist": "BiSH",
              "mirrors": [
                {
                  "quality": "",
                  "mirror": "https://animethemes.moe/video/3DKanojoS2-OP1.webm",
                  "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/37956-00/0/audio"
                },
                {
                  "quality": "NC, BD, 1080",
                  "mirror": "https://animethemes.moe/video/3DKanojoS2-OP1-NCBD1080.webm",
                  "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/37956-00/1/audio"
                }
              ],
              "notes": "",
              "episodes": "",
              "category": ""
            }
          ]
        }
      ]
    },
    {
      "season": "Spring",
      "anime": [
        {
          "mal_id": 38735,
          "title": ["7 Seeds", "7SEEDS"],
          "cover": "https://cdn.myanimelist.net/images/anime/1305/96703.jpg",
          "year": 2019,
          "season": "Spring 2019",
          "themes": [
            {
              "title": "Ark",
              "theme_id": "38735-00",
              "type": "OP",
              "artist": null,
              "mirrors": [
                {
                  "quality": "",
                  "mirror": "https://animethemes.moe/video/7Seeds-OP1.webm",
                  "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/38735-00/0/audio"
                }
              ],
              "notes": "",
              "episodes": "",
              "category": ""
            }
          ]
        }
      ]
    },
    {
      "season": "Summer",
      "anime": [
        {
          "mal_id": 38753,
          "title": [
            "Araburu Kisetsu no Otome-domo yo.",
            "O Maidens in Your Savage Season"
          ],
          "cover": "https://cdn.myanimelist.net/images/anime/1256/101166.jpg",
          "year": 2019,
          "season": "Summer 2019",
          "themes": [
            {
              "title": "Otome-domo yo",
              "theme_id": "38753-00",
              "type": "OP V1",
              "artist": "CHiCO",
              "mirrors": [
                {
                  "quality": "",
                  "mirror": "https://animethemes.moe/video/Araoto-OP1.webm",
                  "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/38753-00/0/audio"
                }
              ],
              "notes": "",
              "episodes": "1-4",
              "category": ""
            }
          ]
        }
      ]
    },
    {
      "season": "Fall",
      "anime": [
        {
          "mal_id": 38670,
          "title": ["Actors: Songs Connection"],
          "cover": "https://cdn.myanimelist.net/images/anime/1383/103339.jpg",
          "year": 2019,
          "season": "Fall 2019",
          "themes": [
            {
              "title": "Titania",
              "theme_id": "38670-00",
              "type": "OP",
              "artist": null,
              "mirrors": [
                {
                  "quality": "",
                  "mirror": "https://animethemes.moe/video/Actors-OP1.webm",
                  "audio": "http://animethemes-api.herokuapp.com/api/v1/theme/38670-00/0/audio"
                }
              ],
              "notes": "",
              "episodes": "",
              "category": ""
            }
          ]
        }
      ]
    }
  ]
}

Get MyAnimeList or AniList anime list

MyAnimeList

/api/v1/mal/:user

/api/v1/mal/:user/:list_filter

Returns a list of the anime in the requested list identified by 'user' (MyAnimeList username) that are available in the data base.

Available filters:

  • All: 7
  • Watching: 1
  • Completed: 2
  • On hold: 3
  • Dropped: 4
  • Planning: 6

AniList

/api/v1/anilist/:user

/api/v1/anilist/:user/:list_filter

Returns a list of the anime in the requested list identified by 'user' (AniList username) that are available in the data base.

Available filters:

  • 'CURRENT'
  • 'PLANNING'
  • 'COMPLETED'
  • 'DROPPED'
  • 'PAUSED'
  • 'REPEATING'

animethemes-api's People

Contributors

letrixz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

afrtite00 luskart

animethemes-api's Issues

Link to audio file is too complicated.

The API currently returns all data about an anime, and it's video mirrors, however you have to download audio by requesting a link again, instead of getting it by default.

Currently I have to make 2 download functions, one for audio and one for video. This makes it overcomplicated.

I suggest instead of having mirrors lead to a video, it should return an audio alternative too.

Authors of the songs

Hello!
Is there a chance to get song's author with GET /anime/id ? It has 'themes' with title, type, mirrors etc of the song but no author :C

Btw thank you for this great API, i didn't expect that someone done it, great job :3

"Anime not found" for Winter 2021 anime

I tried using APIs with two anime from the Winter 2021 season, but I got the error "Anime not found" :

It's weird, I did a search on r / AnimeThemes and I found the openings of these two anime :

I wonder if it's a bug or if I'm using the API badly .

Get [theme_id] of all songs

Hey! Sorry for bothering but is there a way to get all song's ID (theme_id) at once?
And I don't get how to get last added animes/themes.
https://animethemes-api.herokuapp.com/api/v1/latest is ok but
https://animethemes-api.herokuapp.com/api/v1/latest/animes and
https://animethemes-api.herokuapp.com/api/v1/latest/themes leads to Not Found.
Or, for example, I want to get all songs after specific song ID (theme_id) using pages if there is lot of them.

I know I'm asking too much but if you could make the 1st feature - get all theme_id - it would be awesome! It's all I need...

Implement a function to get just the links, making it possible to use this API without additional code.

the problem

Right now using the API requires additional code to be used which could be easily solved by implementing the most used features right in the API.

solution

I would ideally start out with just getting all the links to audio/video files. There can be arguments, but I personally think that at that point, you should implement your own code.

implementation

I personally suggest
/links/<file_type>/<normal_path>
which would for example be
/links/audio/mal/letrixZ/
and that would return a file with all audio links of every theme (only the first of each version) of every anime in letrixZ's anime list.
or /links/video/anime/40060/
which would return all video links of BNA.

advantages

No need to know how to code will let a ton more people to use the API.

disadvantages

The API might start being more focused on users that don't know how to code. This should be avoided as these features should only be considered side features.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.