Commit 965c583ca0
Unsigned
Layout: unified · split
anilist.py added +37
| @@ -0,0 +1,37 @@ | |||
| 1 | import requests | ||
| 2 | |||
| 3 | # Replace with your actual access token and user ID | ||
| 4 | access_token = '' | ||
| 5 | user_id = '6719526' | ||
| 6 | |||
| 7 | # GraphQL query | ||
| 8 | query = """ | ||
| 9 | { | ||
| 10 | MediaListCollection(userId: %s, type: ANIME) { | ||
| 11 | lists { | ||
| 12 | entries { | ||
| 13 | media { | ||
| 14 | id | ||
| 15 | title { | ||
| 16 | romaji | ||
| 17 | english | ||
| 18 | } | ||
| 19 | } | ||
| 20 | status | ||
| 21 | score | ||
| 22 | progress | ||
| 23 | } | ||
| 24 | } | ||
| 25 | } | ||
| 26 | } | ||
| 27 | """ % user_id | ||
| 28 | |||
| 29 | # Send the request | ||
| 30 | response = requests.post( | ||
| 31 | 'https://graphql.anilist.co', | ||
| 32 | json={'query': query}, | ||
| 33 | headers={'Authorization': f'Bearer {access_token}'} | ||
| 34 | ) | ||
| 35 | |||
| 36 | # Print the response | ||
| 37 | print(response.json()) | ||