diff --git a/igmirror.py b/igmirror.py index e878eb6..74bbce1 100644 --- a/igmirror.py +++ b/igmirror.py @@ -96,6 +96,7 @@ def delete_statuses(acc_id): print('E| user "{}" is not logged in. Please log in'.format(acc_id)) return 1 + # check our information to validate our account exists r = requests.get( 'https://'+config()['instance']+'/api/pixelfed/v1/accounts/verify_credentials', cookies=accdata['cookie']) pixdata = json.loads(r.text) if not 'id' in pixdata: @@ -109,6 +110,8 @@ def delete_statuses(acc_id): 'X-CSRF-TOKEN': _token, 'X-XSRF-TOKEN': accdata['cookie']['XSRF-TOKEN'] } + + # delete all statuses on pixelfed by Polling next N items while True: r2 = requests.get('https://'+config()['instance']+'/api/pixelfed/v1/accounts/{}/statuses?min_id=1'.format(pixdata['id']),\ cookies=accdata['cookie'] ) @@ -120,6 +123,8 @@ def delete_statuses(acc_id): r3 = requests.post('https://'+config()['instance']+'/i/delete', json={'item': status['id'], 'type': 'status'},\ cookies=accdata['cookie'], headers=_headers) print(r3.status_code) + + db_set('posts', acc_id, []) print('I| done nuking account posts for "{}"'.format(acc_id)) return 0