KaraKaraWitch's picture
Update README.md
e493ce9 verified
|
raw
history blame
No virus
10.1 kB
metadata
license: cc-by-4.0

Bluesky Aozora Dive

image/png

... Is an archive of atproto's firehose (and relatedly bluesky) streams.

This dataset name is inspired from a song.

Data Formats

We present data as is with minimum enrichment.

  • Any cryptographic CIDs are stripped as they do not possess any useful textual data.

Streams

The firehose is split into 2 jsonl file for your usage:

  • ..._atproto_interactions.jsonl: Contains interaction events, such as likes, follows, reposts and blocks
  • ..._atproto_general.jsonl: Contains accounts, identities, posts and replies

Common Fields

  • typ: Represents the data type.
  • usr: Which User is it from. Represented in the Usernames format below.
  • rid: Record Key. Use this to access data from bsky api.

The most basic root construct will typically contain:

{
    "typ": "<Type>",
    "usr": {
        "did": "did:plc:ssd5xwqvrdrxyu2br7sfjwzy",
    },
}

Usernames are constructed in the following format:

{
    "did": "did:plc:4hqjfn7m6n5hno3doamuhgef",
}

did: Decentralized ID. Consider this as ID for most cases and it points to a unique ID.
nms: [DEPRECATED!] Usernames. Either can be a string or a list of strings. Do not blindly assume this is going to be only a string! Though generally, it should just be a string.

  • nms will not be provided in future firehose archives. Turns out PLC directory didn't like me.

For most cases, expect the did to describe a user.

Blobs

Blobs represent media content. Typically you can tell it's a blob if it has a mime field and a cid.

{
    "mime": "image/jpeg",
    "size": 891965,
    "cid": "bafkreifu35fvx45eyldhpoyb3zgtb5dobvjfpw5kkeexwxefrfpzye2pji"
}

Given the user account is this:

{
    "typ": "account",
    "usr": {
        "did": "did:plc:lri5xcv6ogaldxkigm32wa57",
        "avy": {
            "mime": "image/jpeg",
            "size": 226086,
            "cid": "bafkreif3z2y2rfrfcjt4rwwps4ib7q7qywrdt76bw6dmj5ebqefgllpima"
        },
        "bnr": null,
        "crt": 1723726663.57,
        "dsc": "――あなたの日常に、AIの籠った音色を。\n\n▼思い出や日常、希望をお聞かせください。その想いを曲にいたします。\nhttps://forms.gle/rF2iqwXxabfVEifd7",
        "dsp": "雪白ゆっち feat.AI Creator"
    }
}

Construct the avy url like so:

Template: https://bsky.social/xrpc/com.atproto.sync.getBlob?did=<usr.did>&cid=<usr.avy.cid>

A full link looks like this: https://bsky.social/xrpc/com.atproto.sync.getBlob?did=did:plc:lri5xcv6ogaldxkigm32wa57&cid=bafkreif3z2y2rfrfcjt4rwwps4ib7q7qywrdt76bw6dmj5ebqefgllpima

Yes I did spend a while trying to lookup to see why it is not working.

Posts (Simple)

Posts can get rather complicated. Here's a sample of a simple post.

{
    "typ": "post",
    "usr": {
        "did": "did:plc:ssd5xwqvrdrxyu2br7sfjwzy",
    },
    "rid": "3kzyon77od52v",
    "chg": "create",
    "tst": 1723987630.494,
    "pst": {
        "txt": "✔✔✔On Aug 18, 2024, 11:59 AM(UTC). According to Binance Market Data, Bitcoin has crossed the 60,000 USDT benchmark and is now trading at 60,006.578125 USDT, with a narrowed 1.49% increase in 24 hours.👀👀",
        "emb": null,
        "fct": [],
        "lbl": [],
        "lng": [],
        "tgs": [],
        "rpl": null
    }
}
  • tst: Contains the timestamp in unix float time.
  • chg: Change type. Typically either create or delete for posts. change for allowing Direct Messages.
  • rid: Record Key. Use this to access data from bsky api.
  • pst: Contains the actual posted data.

Posts (Complex)

As for replies and other fields, here's a more complex example.

{
    "typ": "reply",
    "usr": {
        "did": "did:plc:4hqjfn7m6n5hno3doamuhgef",
        "nms": "yui.syui.ai"
    },
    "rid": "3kzyotm2hzq2d",
    "chg": "create",
    "tst": 1723987844.937,
    "pst": {
        "txt": "https://card.syui.ai/baiser \nbaiser\njoin : baiser.blue [IIT]\nten : 1000\naiten : 21037247\n---\n[1-7]\nten d : shuffle[IIT☑]\nten p : post\n---\n",
        "emb": null,
        "fct": [
            {
                "typ": "@",
                "val": "https://card.syui.ai/baiser",
                "rng": [
                    0,
                    27
                ]
            }
        ],
        "lbl": [],
        "lng": [],
        "tgs": [],
        "rpl": {
            "typ": "post",
            "usr": {
                "did": "did:plc:vok247eewjmbmo3kxaizct2i",
                "nms": "baiser.blue"
            },
            "rid": "3kzyotbooo22c",
            "rrt": {
                "typ": "post",
                "usr": {
                    "did": "did:plc:vok247eewjmbmo3kxaizct2i",
                    "nms": "baiser.blue"
                },
                "rid": "3kzyosf6atg2v"
            }
        }
    }
}
  • fct: Stands for Facets:
    • typ: The facet type. (tag,link,mention)
    • val: The facet value. Note that this can be a Username dict when typ == mention
    • rng: Byte range. AFAIK this is in UTF-16 but I can be wrong. Follow atproto's docs for this.
  • lbl: Labels. A list of strings. Though typically empty list for firehose streams. Labels are sent seperately firehose stream-wise.
  • lng: Languages. Either an list (Can be empty) or a string.
  • tgs: "Additional hashtags, in addition to any included in post text and facets." rpl: The post that the current post is replying to.
    • Note: The reply post is not enriched with the actual post.
    • typ/usr/rid: Refer to the simple posts section.
    • rrt: Root post. Can be null if root post is the same as the rpl post rid.

Accounts

{
    "typ": "account",
    "usr": {
        "did": "did:plc:cj3ngde5wbljf5sh33g7zsdz",
        "avy": {
            "mime": "image/jpeg",
            "size": 79776,
            "cid": "bafkreiczz2spptgturm43r33impbkcar4tmdmnh34pqkp2tynlztbxmw7a"
        },
        "bnr": {
            "mime": "image/jpeg",
            "size": 748930,
            "cid": "bafkreigb5l3u32quxzhpbca6bnrunfdau3m4bp6fdntmj2lwec3erkssty"
        },
        "crt": null,
        "dsc": "こっちでは、主に練習中の下手なイラスト・ゲーム関系とかを投稿していきたいな〜\n\n最推しのねくろさんの配信を見るといやされる( ◠‿◠ )",
        "dsp": "しろっつ🖤🐐👑"
    }
}

For Accounts, the usr field is more filled. In addition to did, there are other fields like:

  • avy/bnr: either a Blob or null. Refer to Blobs section above.
  • crt: Account Creation time. Can be null!
  • dsc: Profile Bio / Blurb Section.
  • dsp: Display name.

Reconstructing to a AtUri

For post and reply types, Take the following values and combine them into the following url:

at://<usr.did>/app.bsky.feed.post/<rid>

Replies are just posts.

For repost and like types, it's similar but a bit different:

  • Reposts: at://<usr.did>/app.bsky.feed.repost/<rid>
  • likes: at://<usr.did>/app.bsky.feed.like/<rid>

Enrichment of replies

curl -L -X GET 'https://public.api.bsky.app/xrpc/app.bsky.feed.getPosts?uris=at://did:plc:4hqjfn7m6n5hno3doamuhgef/app.bsky.feed.post/3kzyotm2hzq2d' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>'

Illegal Spec Followers

In other words, we also capture content that failed to follow specs. Like this:

{
    "typ": "IllegalSpecFollowerAkaFixYourShit",
    "record": {
        "text": "任某(男,31歲),被行拘! ",
        "$type": "app.bsky.feed.post",
        "embed": {
            "uri": "https://www.headline01.com/a/Xio3zSUuGvX7J1jCSG_F5g-51479340.html",
            "$type": "app.bsky.embed.external#main",
            "external": {
                "uri": "https://www.headline01.com/a/Xio3zSUuGvX7J1jCSG_F5g-51479340.html",
                "thumb": {
                    "ref": "bafkreidrfrfluqo26yy4pemkcpgug2p5sea3xrwh3schfnns5owa7gbwvm",
                    "size": 86924,
                    "$type": "blob",
                    "mimeType": "image/jpeg"
                },
                "title": "任某(男,31歲),被行拘!",
                "description": ""
            }
        },
        "createdAt": "2024-08-18T14:05:19.645644Z"
    }
}

Lines marked as IllegalSpecFollowerAkaFixYourShit should be ignored in general though. Content isn't great anyway.

Changes

[01/09/24]

Removed mentions of nms. We stopped resolving DIDs after 01/09/24 as it appears that I'm slamming PLC directory too much lol. Sorry!

Various Notes

Recommendations

For getting a more proper stream of posts, it's recommended to keep a track of users + posts in a index cache.

Then again, you can just fetch a list from bsky api directly lol.

Do consider reading up on bsky docs and atproto docs.

Docs Nonsense

When the bluesky docs say: "...Implemented by PDS".

You should probably use the following base url: https://bsky.social/xrpc/

Deletions

UnActions ("unpost","unlike","unrepost") only contains rid as the record key.

License

For everyone out there, data is meant to be free unlike some previous license I did. This is free for grabs aka CC-BY-4.0.

for Big Corps wanting to use it: Sure. As long as you cite this dataset + CC-BY-4.0 license. Be nice to people who have came before you and did it.

Citations

We would much love academia to cite this dataset. Be nice please :)

@misc{bskyaozora,
  title         = {Aozora Diving: diving into the sea of atproto and bluesky network },
  author        = {KaraKaraWitch},
  year          = {2023},
  howpublished  = {\url{https://huggingface.co/datasets/WitchesSocialStream/bluesky-Aozora-Diving}},
}