Something went wrong. Try again.
Migrate follows from one account to another
Something went wrong. Try again.
617 B · 24 lines · Created 3w ago
Python
123456789101112131415161718192021222324import os
from atproto import CAR, Client, models
from atproto_utils.car import walk_car
APP_PASSWORD = os.environ["BSKY_APP_PASSWORD"]CAR_FILE_PATH = os.environ["CAR_FILE_PATH"]
with open(CAR_FILE_PATH, "rb") as fh: car = CAR.from_bytes(fh.read())
follows = [ car.blocks[cid] for path, cid in walk_car(car) if path.startswith("app.bsky.graph.follow/")]
client = Client("https://eurosky.social")profile = client.login("juanlu.mu.social", APP_PASSWORD)
for follow in follows: record = models.AppBskyGraphFollow.Record(**follow) client.app.bsky.graph.follow.create(profile.did, record)