Remove posts from database too! + comments
This commit is contained in:
parent
9414a6adc6
commit
e5c6c9e2c5
|
@ -96,6 +96,7 @@ def delete_statuses(acc_id):
|
||||||
print('E| user "{}" is not logged in. Please log in'.format(acc_id))
|
print('E| user "{}" is not logged in. Please log in'.format(acc_id))
|
||||||
return 1
|
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'])
|
r = requests.get( 'https://'+config()['instance']+'/api/pixelfed/v1/accounts/verify_credentials', cookies=accdata['cookie'])
|
||||||
pixdata = json.loads(r.text)
|
pixdata = json.loads(r.text)
|
||||||
if not 'id' in pixdata:
|
if not 'id' in pixdata:
|
||||||
|
@ -109,6 +110,8 @@ def delete_statuses(acc_id):
|
||||||
'X-CSRF-TOKEN': _token,
|
'X-CSRF-TOKEN': _token,
|
||||||
'X-XSRF-TOKEN': accdata['cookie']['XSRF-TOKEN']
|
'X-XSRF-TOKEN': accdata['cookie']['XSRF-TOKEN']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# delete all statuses on pixelfed by Polling next N items
|
||||||
while True:
|
while True:
|
||||||
r2 = requests.get('https://'+config()['instance']+'/api/pixelfed/v1/accounts/{}/statuses?min_id=1'.format(pixdata['id']),\
|
r2 = requests.get('https://'+config()['instance']+'/api/pixelfed/v1/accounts/{}/statuses?min_id=1'.format(pixdata['id']),\
|
||||||
cookies=accdata['cookie'] )
|
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'},\
|
r3 = requests.post('https://'+config()['instance']+'/i/delete', json={'item': status['id'], 'type': 'status'},\
|
||||||
cookies=accdata['cookie'], headers=_headers)
|
cookies=accdata['cookie'], headers=_headers)
|
||||||
print(r3.status_code)
|
print(r3.status_code)
|
||||||
|
|
||||||
|
db_set('posts', acc_id, [])
|
||||||
print('I| done nuking account posts for "{}"'.format(acc_id))
|
print('I| done nuking account posts for "{}"'.format(acc_id))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue