Created
January 21, 2019 08:32
-
-
Save purplepinapples/5dc60f15f2837bf1cea71b089cfeaa0a to your computer and use it in GitHub Desktop.
Use Anilist API to get an AniList entry from a MAL id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import requests | |
query = '''query($id: Int, $type: MediaType){Media(idMal: $id, type: $type){siteUrl}}''' | |
variables = { | |
'id': 30831, | |
'type': "ANIME" | |
} | |
url = 'https://graphql.anilist.co' | |
response = requests.post(url, json={'query': query, 'variables': variables}) | |
print(response.json()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The plain php version (I'll make this into a package soon)