--- license: cc-by-4.0 viewer: false --- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/633e85093a17ab61de8d9073/Kj4renO3qwTYmKanrPb8B.png) ## Data Formats We present data as is with minimum enrichment. - Any cryptographic CIDs are stripped as they do not possess any useful textual data. ### Changelog - 21/11/24: - Fixed Videos being uploaded as `null` - Code is more robust. Should be less prone to dropouts. - Did some code refactoring... - ...and subsequently broke some MiracleSpec messages... - ...But it has been fixed. - 25/11/24: - Fixed: Follow and block actions didn't have `chg` values associated previously, making it hard to determine if the user followed or unfollowed. This has been fixed. - 27/11/24: - Started to ignore certain miracle road spec data. A list is shown below with a reasoning. - We reject external "Link" / Not tied to bluesky data. - 13/12/24: - ~~No changes but just a word of caution: **There might be leaked keys.** I haven't been acting on them based on the basis of "If you post it, you better fix it." policy.~~ - As a countermeasure for future occurances, I've blocked HF Forums's bridgy bot. Future bridgy bots may be blocked as well. - 07/02/25: - New cover image. - Cleaned up front header bits. - 25/04/25: - Refreshed code, no visible changes - Added verfications (finally bluesky has verifications) ### Blocks Ignored `$type` / `Miracle Roads`: - `jp.5leaf.sync.mastodon` (Reason: Sync from mastodon.) Ignored Users: - `did:plc:pgryn3ephfd2xgft23qokfzt` (Reason: Bridgy bot for HF Forums to bluesky. People keep accidentally leaking the HF tokens.) ### Streams The firehose is split into ~~2~~ 3 jsonl file for your usage: - `..._atproto_interactions.jsonl`: Contains interaction events, such as likes, follows, reposts and blocks - `..._atproto_general.jsonl`: Contains posts and replies. Used to contain accounts & identities but they have been moved to `_accounts.jsonl` - `..._atproto_accounts.jsonl`: Accounts & identities. ### Common Fields - `typ`: Represents the data **typ**e. - `usr`: Which **Us**e**r** 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: ```json { "typ": "", "usr": { "did": "did:plc:ssd5xwqvrdrxyu2br7sfjwzy", }, } ``` Usernames are constructed in the following format: ```json { "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`. ```json { "mime": "image/jpeg", "size": 891965, "cid": "bafkreifu35fvx45eyldhpoyb3zgtb5dobvjfpw5kkeexwxefrfpzye2pji" } ``` Given the user account is this: ```json { "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=&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. ```json { "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. ```json { "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.](#posts-simple) - `rrt`: Root post. Can be `null` if root post is the same as the `rpl` post `rid`. - `emb`: Any rich embed. - Embed primarily has around 5 types 1. Images - A list of images. - Each image contains: `img` (BlobRef), `alt` (Alt Text), `isz` (Size) 3. Video - A Video - Contains the following fields: `vid`, `alt` (Alt Text), `isz` (Size), `cpt` (Captions, Dictionary with of key for languages and a BlobRef for value) 4. External (Outside bluesky) - Typically webpages and the like 5. w/ Record (A post that has a link to another person) 6. Same as 5 but with Images. - TL;DR: Embeds are complicated. ### Accounts ```json { "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](#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:///app.bsky.feed.post/` Replies are just posts. For `repost` and `like` types, it's similar but a bit different: - Reposts: `at:///app.bsky.feed.repost/` - likes: `at:///app.bsky.feed.like/` ### 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 ' ``` ### "Miracle Spec" Recently, some creative folks have started adding their own data to the atproto stream. Some notable examples I saw are: - `com.whtwnd.blog.entry` (https://whtwnd.com/about) - `space.aoisora.bookmark` (https://bsky.app/profile/mimonelu.net/post/3l4ta2mdqwe2s) As of 01/10/24, I've added support for those.. They are labeled as "MiracleRoad!" for `typ` and only contain the raw record data. ### Illegal Spec Followers In other words, we also capture content that failed to follow specs. Like this: ```json { "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! **[04/09/24]** Fixed video embeds as it started to crash the scraper resuling in some missing stuff. ## 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 `:)` ```tex @misc{bskyaozora, title = {Aozora Diving: diving into the sea of atproto and bluesky network }, author = {KaraKaraWitch}, year = {2024}, howpublished = {\url{https://huggingface.co/datasets/WitchesSocialStream/bluesky-Aozora-Diving}}, } ```