Compare commits

...

3 Commits

Author SHA1 Message Date
5e2b4f3408 docs: update readme 2025-12-19 14:10:37 +01:00
c238278df6 feat: add quote post deletion 2025-12-19 14:10:33 +01:00
a9c25c8c10 feat: implemented delete_quotes() 2025-12-19 14:10:25 +01:00
3 changed files with 84 additions and 3 deletions

View File

@@ -57,7 +57,7 @@ BE SURE TO USE A [BLUESKY APP PASSWORD](https://blueskyfeeds.com/faq-app-passwor
- [x] only delete posts with media - [x] only delete posts with media
- [x] undo likes - [x] undo likes
- [x] undo reposts - [x] undo reposts
- [ ] delete quotes - [x] delete quotes
- [ ] unfollow accounts - [ ] unfollow accounts
- [ ] remove bookmarks - [ ] remove bookmarks
- [ ] make `all` run the other commands - [ ] make `all` run the other commands

View File

@@ -6,6 +6,7 @@ from .posts import delete_posts
from .medias import delete_posts_with_medias from .medias import delete_posts_with_medias
from .likes import undo_likes from .likes import undo_likes
from .reposts import undo_reposts from .reposts import undo_reposts
from .quotes import delete_quotes
CommandHandler = Callable[[], None] CommandHandler = Callable[[], None]
@@ -73,7 +74,7 @@ def run_reposts():
def run_quotes(): def run_quotes():
print("Command 'quotes' is not yet implemented.") delete_quotes()
def run_follows(): def run_follows():
@@ -100,7 +101,7 @@ registry.register("posts", run_posts, "only posts")
registry.register("medias", run_medias, "only posts with medias") registry.register("medias", run_medias, "only posts with medias")
registry.register("likes", run_likes, "only likes") registry.register("likes", run_likes, "only likes")
registry.register("reposts", run_reposts, "only reposts") registry.register("reposts", run_reposts, "only reposts")
registry.register("quotes", run_reposts, "only quotes") registry.register("quotes", run_quotes, "only quotes")
registry.register("follows", run_follows, "only follows") registry.register("follows", run_follows, "only follows")
registry.register("bookmarks", run_follows, "only bookmarks") registry.register("bookmarks", run_follows, "only bookmarks")
registry.register("all", run_all, "target everything") registry.register("all", run_all, "target everything")

80
skywipe/quotes.py Normal file
View File

@@ -0,0 +1,80 @@
"""Quote post deletion module for Skywipe"""
import time
from .auth import Auth
from .configure import Configuration
def has_quote_embed(post_record):
embed = getattr(post_record, 'embed', None)
if not embed:
return False
embed_type = getattr(embed, 'py_type', None)
if embed_type:
embed_type_base = embed_type.split('#')[0]
quote_types = {
'app.bsky.embed.record',
'app.bsky.embed.recordWithMedia',
'app.bsky.embed.record_with_media'
}
if embed_type_base in quote_types:
return True
if hasattr(embed, 'record') or (isinstance(embed, dict) and embed.get('record')):
return True
return False
def delete_quotes():
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 quote post deletion with batch_size={batch_size}, delay={delay}s")
did = client.me.did
cursor = None
total_deleted = 0
while True:
response = client.get_author_feed(
actor=did, limit=batch_size, cursor=cursor)
posts = response.feed
if not posts:
break
for post in posts:
post_record = post.post
if not has_quote_embed(post_record):
if verbose:
print(f"Skipping post without quote: {post_record.uri}")
continue
try:
client.delete_post(post_record.uri)
total_deleted += 1
if verbose:
print(f"Deleted quote post: {post_record.uri}")
except Exception as e:
if verbose:
print(f"Error deleting quote post {post_record.uri}: {e}")
cursor = response.cursor
if not cursor:
break
if delay > 0:
time.sleep(delay)
print(f"Deleted {total_deleted} quote posts.")