洪 民憙 (Hong Minhee)
@[email protected] · Reply to S.H.@Haloはいいぞ's post
@S_H_ 出来そうですね!
// download-activities.ts
import { isActor, lookupObject, traverseCollection } from "jsr:@fedify/fedify";
const actor = await lookupObject("@[email protected]");
if (!isActor(actor)) Deno.exit(1);
console.debug("Actor fetched:", actor.name);
const outbox = await actor.getOutbox();
if (outbox == null) Deno.exit(1);
let i = 0;
for await (
const activity of traverseCollection(outbox, { suppressError: true })
) {
const json = await activity.toJsonLd({ format: "compact" });
const filename = `${i++}.json`;
await Deno.writeTextFile(filename, JSON.stringify(json, undefined, 2));
console.debug(activity.id?.href, "->", filename);
}
deno run -A --unstable-temporal download-activities.ts