Gatico_Mstdn

Borrar todos los toots de tu cuenta Mastodon

Apr 22nd, 2020
1,559
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.22 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. # Descargar libreria Mastodon en: https://github.com/halcy/Mastodon.py
  5. from mastodon import Mastodon
  6.  
  7. API_BASE_URL = 'https://qoto.org'       # url de la instancia
  8. CUENTA_CORREO = 'correo@servidor.algo'  # correo usado para crear la cuenta
  9. CUENTA_PASS = 'contraseña'              # contraseña de la cuenta
  10.  
  11. Mastodon.create_app(
  12.      'pytooterapp',
  13.      api_base_url = API_BASE_URL,
  14.      to_file = 'pytooter_clientcred.secret'
  15. )
  16.  
  17. mastodon = Mastodon(
  18.     client_id = 'pytooter_clientcred.secret',
  19.     api_base_url = API_BASE_URL
  20. )
  21.  
  22. mastodon.log_in(
  23.     CUENTA_CORREO,
  24.     CUENTA_PASS,
  25.     to_file = 'pytooter_usercred.secret'
  26. )
  27.  
  28. res = mastodon.toot('toot para conocer tu id') # publica un toot
  29. id_usu = res.account.id # sacamos tu id de usuario
  30. while True:
  31.     toots = mastodon.account_statuses(id_usu) # sacamos tus ultimos 20 toots
  32.     if len(toots)<=0:
  33.         break
  34.        
  35.     for toot in toots:
  36.         res = toot.uri.split('/')
  37.         if res[-1]=='activity':
  38.             id_estado = res[-2]
  39.         else:
  40.             id_estado = res[-1]
  41.         print id_estado
  42.         mastodon.status_delete(id_estado) # borramos
  43.        
  44.     print 'Ya no hay mas'
Add Comment
Please, Sign In to add comment