bsky feeds about music music-atmosphere-feed.plyr.fm/
bsky feed zig

adopt zat.json.extractAt for getAuthorFeed

uses comptime struct extraction instead of manual path navigation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

+20 -9
+2 -2
build.zig.zon
··· 13 13 .hash = "zqlite-0.0.0-RWLaY_y_mADh2LdbDrG_2HT2dBAcsAR8Jig_7-dOJd0B", 14 14 }, 15 15 .zat = .{ 16 - .url = "https://github.com/zzstoatzz/zat/archive/refs/heads/main.tar.gz", 17 - .hash = "zat-0.0.1-alpha-5PuC7inqAAD6Sj8RCKLcLzUKnYgMPM_aGduBokzzLSRS", 16 + .url = "https://tangled.org/zzstoatzz.io/zat/archive/main", 17 + .hash = "zat-0.0.1-alpha-5PuC7tP4AAAUmi43Fx2cjUQc-yfJHWpz2aDzEV5b82bK", 18 18 }, 19 19 }, 20 20 .paths = .{
+18 -7
src/stream/atproto.zig
··· 365 365 embed_uri: ?[]const u8, 366 366 }; 367 367 368 + /// struct for extracting post data from feed items 369 + const FeedPost = struct { 370 + uri: []const u8, 371 + cid: []const u8, 372 + record: struct { 373 + text: []const u8 = "", 374 + embed: ?struct { 375 + external: ?struct { uri: []const u8 } = null, 376 + } = null, 377 + }, 378 + }; 379 + 368 380 /// fetch recent posts from an author's feed. 369 381 pub fn getAuthorFeed(allocator: Allocator, actor_did: []const u8, limit: usize) ![]AuthorPost { 370 382 var client = zat.XrpcClient.init(allocator, BSKY_PUBLIC_API); ··· 409 421 const feed = zat.json.getArray(parsed.value, "feed") orelse return try posts.toOwnedSlice(allocator); 410 422 411 423 for (feed) |item| { 412 - const uri = zat.json.getString(item, "post.uri") orelse continue; 413 - const cid = zat.json.getString(item, "post.cid") orelse continue; 414 - const text = zat.json.getString(item, "post.record.text") orelse ""; 415 - const embed_uri = zat.json.getString(item, "post.record.embed.external.uri"); 424 + const post = zat.json.extractAt(FeedPost, allocator, item, .{"post"}) catch continue; 425 + 426 + const embed_uri = if (post.record.embed) |e| if (e.external) |ext| ext.uri else null else null; 416 427 417 428 try posts.append(allocator, .{ 418 - .uri = try allocator.dupe(u8, uri), 419 - .cid = try allocator.dupe(u8, cid), 420 - .text = try allocator.dupe(u8, text), 429 + .uri = try allocator.dupe(u8, post.uri), 430 + .cid = try allocator.dupe(u8, post.cid), 431 + .text = try allocator.dupe(u8, post.record.text), 421 432 .embed_uri = if (embed_uri) |eu| try allocator.dupe(u8, eu) else null, 422 433 }); 423 434 }