Compare commits

...

3 Commits

Author SHA1 Message Date
5868c1649b docs: update readme 2025-12-19 14:35:25 +01:00
a14184cddc feat: run all 2025-12-19 14:35:21 +01:00
6587f8c39c feat: implement bookmark deletion module 2025-12-19 14:35:05 +01:00
3 changed files with 95 additions and 17 deletions

View File

@@ -58,9 +58,9 @@ BE SURE TO USE A [BLUESKY APP PASSWORD](https://blueskyfeeds.com/faq-app-passwor
- [x] undo likes
- [x] undo reposts
- [x] delete quotes
- [ ] unfollow accounts
- [ ] remove bookmarks
- [ ] make `all` run the other commands
- [x] unfollow accounts
- [x] remove bookmarks
- [x] make `all` run the other commands
- [ ] add simple progress and logging
- [ ] add safeguards like confirmations and clear dry-run info

75
skywipe/bookmarks.py Normal file
View File

@@ -0,0 +1,75 @@
"""Bookmark deletion module for Skywipe"""
import time
from atproto import models
from .auth import Auth
from .configure import Configuration
def delete_bookmarks():
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 bookmark deletion with batch_size={batch_size}, delay={delay}s")
cursor = None
total_deleted = 0
while True:
get_params = models.AppBskyBookmarkGetBookmarks.Params(
limit=batch_size,
cursor=cursor
)
response = client.app.bsky.bookmark.get_bookmarks(params=get_params)
bookmarks = response.bookmarks
if not bookmarks:
break
for bookmark in bookmarks:
try:
bookmark_uri = None
if hasattr(bookmark, "uri"):
bookmark_uri = bookmark.uri
else:
for attr_name in ("subject", "record", "post", "item"):
if hasattr(bookmark, attr_name):
nested = getattr(bookmark, attr_name)
if hasattr(nested, "uri"):
bookmark_uri = nested.uri
break
if not bookmark_uri:
if verbose:
print(f"Skipping bookmark: unable to find uri")
continue
delete_data = models.AppBskyBookmarkDeleteBookmark.Data(
uri=bookmark_uri
)
client.app.bsky.bookmark.delete_bookmark(data=delete_data)
total_deleted += 1
if verbose:
print(f"Deleted bookmark: {bookmark_uri}")
except Exception as e:
bookmark_uri = getattr(bookmark, "uri", "unknown")
if verbose:
print(f"Error deleting bookmark {bookmark_uri}: {e}")
cursor = response.cursor
if not cursor:
break
if delay > 0:
time.sleep(delay)
print(f"Deleted {total_deleted} bookmarks.")

View File

@@ -2,11 +2,13 @@
from typing import Callable, Dict, Optional
from .configure import Configuration
from .posts import delete_posts
from .posts import delete_all_posts
from .medias import delete_posts_with_medias
from .likes import undo_likes
from .reposts import undo_reposts
from .quotes import delete_quotes
from .quotes import delete_quotes_posts
from .follows import unfollow_all
from .bookmarks import delete_bookmarks
CommandHandler = Callable[[], None]
@@ -58,7 +60,7 @@ def run_configure():
def run_posts():
delete_posts()
delete_all_posts()
def run_medias():
@@ -74,25 +76,26 @@ def run_reposts():
def run_quotes():
delete_quotes()
delete_quotes_posts()
def run_follows():
print("Command 'follows' is not yet implemented.")
unfollow_all()
def run_bookmarks():
print("Command 'bookmarks' is not yet implemented")
delete_bookmarks()
def run_all():
registry.execute("posts")
registry.execute("medias")
registry.execute("likes")
registry.execute("reposts")
registry.execute("quotes")
registry.execute("follows")
registry.execute("bookmarks")
commands = ["posts", "likes", "reposts", "follows", "bookmarks"]
for cmd in commands:
try:
registry.execute(cmd)
except Exception as e:
print(f"Error running '{cmd}': {e}")
continue
registry.register("configure", run_configure,
@@ -103,5 +106,5 @@ registry.register("likes", run_likes, "only likes")
registry.register("reposts", run_reposts, "only reposts")
registry.register("quotes", run_quotes, "only quotes")
registry.register("follows", run_follows, "only follows")
registry.register("bookmarks", run_follows, "only bookmarks")
registry.register("bookmarks", run_bookmarks, "only bookmarks")
registry.register("all", run_all, "target everything")