Compare commits
2 Commits
8090a3432c
...
1c7a903131
| Author | SHA1 | Date | |
|---|---|---|---|
| 1c7a903131 | |||
| 472b828f72 |
@@ -63,7 +63,7 @@ BE SURE TO USE A [BLUESKY APP PASSWORD](https://blueskyfeeds.com/faq-app-passwor
|
|||||||
- [x] build cli parameter management
|
- [x] build cli parameter management
|
||||||
- [x] handle configuration logic
|
- [x] handle configuration logic
|
||||||
- [x] sign in to at protocol
|
- [x] sign in to at protocol
|
||||||
- [ ] delete posts in groups
|
- [x] delete posts in batch
|
||||||
- [ ] only delete posts with media
|
- [ ] only delete posts with media
|
||||||
- [ ] remove likes
|
- [ ] remove likes
|
||||||
- [ ] remove reposts
|
- [ ] remove reposts
|
||||||
|
|||||||
56
skywipe/posts.py
Normal file
56
skywipe/posts.py
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
"""Post deletion module for Skywipe CLI."""
|
||||||
|
|
||||||
|
import time
|
||||||
|
from skywipe.auth import Auth
|
||||||
|
from skywipe.configure import Configuration
|
||||||
|
|
||||||
|
|
||||||
|
def delete_posts():
|
||||||
|
auth = Auth()
|
||||||
|
client = auth.login()
|
||||||
|
config = Configuration()
|
||||||
|
config_data = config.load()
|
||||||
|
|
||||||
|
batch_size = config_data.get("batch_size", 10)
|
||||||
|
delay = config_data.get("delay", 1)
|
||||||
|
verbose = config_data.get("verbose", False)
|
||||||
|
|
||||||
|
if verbose:
|
||||||
|
print(
|
||||||
|
f"Starting post deletion with batch_size={batch_size}, delay={delay}s")
|
||||||
|
|
||||||
|
did = client.me.did
|
||||||
|
cursor = None
|
||||||
|
total_deleted = 0
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if cursor:
|
||||||
|
response = client.get_author_feed(
|
||||||
|
actor=did, limit=batch_size, cursor=cursor)
|
||||||
|
else:
|
||||||
|
response = client.get_author_feed(actor=did, limit=batch_size)
|
||||||
|
|
||||||
|
posts = response.feed
|
||||||
|
if not posts:
|
||||||
|
break
|
||||||
|
|
||||||
|
post_uris = [post.post.uri for post in posts]
|
||||||
|
|
||||||
|
for uri in post_uris:
|
||||||
|
try:
|
||||||
|
client.delete_post(uri)
|
||||||
|
total_deleted += 1
|
||||||
|
if verbose:
|
||||||
|
print(f"Deleted post: {uri}")
|
||||||
|
except Exception as e:
|
||||||
|
if verbose:
|
||||||
|
print(f"Error deleting post {uri}: {e}")
|
||||||
|
|
||||||
|
cursor = response.cursor
|
||||||
|
if not cursor:
|
||||||
|
break
|
||||||
|
|
||||||
|
if delay > 0:
|
||||||
|
time.sleep(delay)
|
||||||
|
|
||||||
|
print(f"Deleted {total_deleted} posts.")
|
||||||
Reference in New Issue
Block a user