Compare commits
3 Commits
a4b622bfd3
...
5ff25b3eb6
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ff25b3eb6 | |||
| c396ba8ae9 | |||
| d12f14a994 |
18
README.md
18
README.md
@@ -20,22 +20,6 @@ uv sync
|
|||||||
|
|
||||||
## How to run
|
## How to run
|
||||||
|
|
||||||
When installation will be worked out, you'll be able to :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
skywipe all # target everything
|
|
||||||
skywipe configure # create configuration
|
|
||||||
skywipe posts # delete posts
|
|
||||||
skywipe medias # delete posts with medias
|
|
||||||
skywipe likes # undo likes
|
|
||||||
skywipe reposts # undo reposts
|
|
||||||
skywipe quotes # delete quotes
|
|
||||||
skywipe follows # unfollow all
|
|
||||||
skywipe bookmarks # delete bookmarks
|
|
||||||
```
|
|
||||||
|
|
||||||
### Running with `uv` (without installation)
|
|
||||||
|
|
||||||
While it's being developed, you can use the tool using `uv` :
|
While it's being developed, you can use the tool using `uv` :
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -72,7 +56,7 @@ BE SURE TO USE A [BLUESKY APP PASSWORD](https://blueskyfeeds.com/faq-app-passwor
|
|||||||
- [x] delete posts in batch
|
- [x] delete posts in batch
|
||||||
- [x] only delete posts with media
|
- [x] only delete posts with media
|
||||||
- [x] undo likes
|
- [x] undo likes
|
||||||
- [ ] undo reposts
|
- [x] undo reposts
|
||||||
- [ ] delete quotes
|
- [ ] delete quotes
|
||||||
- [ ] unfollow accounts
|
- [ ] unfollow accounts
|
||||||
- [ ] remove bookmarks
|
- [ ] remove bookmarks
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from .configure import Configuration
|
|||||||
from .posts import delete_posts
|
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
|
||||||
|
|
||||||
|
|
||||||
CommandHandler = Callable[[], None]
|
CommandHandler = Callable[[], None]
|
||||||
@@ -68,7 +69,7 @@ def run_likes():
|
|||||||
|
|
||||||
|
|
||||||
def run_reposts():
|
def run_reposts():
|
||||||
print("Command 'reposts' is not yet implemented.")
|
undo_reposts()
|
||||||
|
|
||||||
|
|
||||||
def run_quotes():
|
def run_quotes():
|
||||||
|
|||||||
69
skywipe/reposts.py
Normal file
69
skywipe/reposts.py
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
"""Repost undoing module for Skywipe"""
|
||||||
|
|
||||||
|
import time
|
||||||
|
from atproto import models
|
||||||
|
from .auth import Auth
|
||||||
|
from .configure import Configuration
|
||||||
|
|
||||||
|
|
||||||
|
REPOST_COLLECTION = "app.bsky.feed.repost"
|
||||||
|
|
||||||
|
|
||||||
|
def undo_reposts():
|
||||||
|
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 repost deletion with batch_size={batch_size}, delay={delay}s")
|
||||||
|
|
||||||
|
did = client.me.did
|
||||||
|
cursor = None
|
||||||
|
total_undone = 0
|
||||||
|
|
||||||
|
while True:
|
||||||
|
list_params = models.ComAtprotoRepoListRecords.Params(
|
||||||
|
repo=did,
|
||||||
|
collection=REPOST_COLLECTION,
|
||||||
|
limit=batch_size,
|
||||||
|
cursor=cursor
|
||||||
|
)
|
||||||
|
|
||||||
|
response = client.com.atproto.repo.list_records(params=list_params)
|
||||||
|
|
||||||
|
records = response.records
|
||||||
|
if not records:
|
||||||
|
break
|
||||||
|
|
||||||
|
for record in records:
|
||||||
|
try:
|
||||||
|
record_uri = record.uri
|
||||||
|
rkey = record_uri.rsplit("/", 1)[-1]
|
||||||
|
delete_data = {
|
||||||
|
"repo": did,
|
||||||
|
"collection": REPOST_COLLECTION,
|
||||||
|
"rkey": rkey
|
||||||
|
}
|
||||||
|
client.com.atproto.repo.delete_record(data=delete_data)
|
||||||
|
total_undone += 1
|
||||||
|
if verbose:
|
||||||
|
print(f"Undone repost: {record_uri}")
|
||||||
|
except Exception as e:
|
||||||
|
record_uri = getattr(record, "uri", "unknown")
|
||||||
|
if verbose:
|
||||||
|
print(f"Error undoing repost {record_uri}: {e}")
|
||||||
|
|
||||||
|
cursor = response.cursor
|
||||||
|
if not cursor:
|
||||||
|
break
|
||||||
|
|
||||||
|
if delay > 0:
|
||||||
|
time.sleep(delay)
|
||||||
|
|
||||||
|
print(f"Undone {total_undone} reposts.")
|
||||||
Reference in New Issue
Block a user