Skip to content

Instantly share code, notes, and snippets.

@purplepinapples
Created January 21, 2019 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save purplepinapples/5dc60f15f2837bf1cea71b089cfeaa0a to your computer and use it in GitHub Desktop.
Save purplepinapples/5dc60f15f2837bf1cea71b089cfeaa0a to your computer and use it in GitHub Desktop.
Use Anilist API to get an AniList entry from a MAL id
#!/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())
@purplepinapples
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment