SharkeyForget/forget.py
2024-04-05 23:24:26 +00:00

33 lines
1.1 KiB
Python

import requests
#Customize for your instance, must be changed for it to work!!
token = "<Your Token here>"
UserID = "<Your UserID here>"
NoteEndpoint = "https://fedi.catboy.agency/api/users/notes"
DeleteEndpoint = "https://fedi.catboy.agency/api/notes/delete"
PostsLeft = True
while PostsLeft:
cycleAmount = 99 #max is 99 normally
headers = {"Content-Type": "application/json; charset=utf-8"}
data = {"userId":UserID,"withRenotes":True,"withReplies":True,"withChannelNotes":True,"withFiles":False,"limit":cycleAmount,"i":token}
r = requests.post(url=NoteEndpoint, headers=headers, json=data)
posts = r.json()
if len(posts) < cycleAmount:
PostsLeft = False
for post in posts:
deleteData = {"noteId":post["id"],"i":token}
r = requests.post(url=DeleteEndpoint, headers=headers, json=deleteData)
print("====================================================")
print("Delete for ["+post["id"]+"]:"+str(r.status_code))
print(post["text"])
print("====================================================")