aboutsummaryrefslogtreecommitdiff
path: root/src/due/media.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/due/media.py')
-rw-r--r--src/due/media.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/due/media.py b/src/due/media.py
index 5dde303..8c86855 100644
--- a/src/due/media.py
+++ b/src/due/media.py
@@ -15,6 +15,23 @@ def user_id(anilist):
)
+def last_activity(id):
+ return int(
+ requests.post(
+ "https://graphql.anilist.co",
+ json={
+ "query": f"""{{ Activity(userId: {id}, type: MEDIA_LIST, sort: ID_DESC) {{
+ __typename ... on ListActivity {{ createdAt }}
+ }} }}"""
+ },
+ headers={
+ "Content-Type": "application/json",
+ "Accept": "application/json",
+ },
+ ).json()["data"]["Activity"]["createdAt"]
+ )
+
+
def user_name_to_id(name):
return int(
requests.post(