Filtering firehose to only new posts? #422
|
I suspect that I am just doing something wrong because I don't fully understand the underlying atproto scheme here, but I think this code should be filtering the firehouse down to just new posts/replies: async def on_message_handler(message) -> None:
if message.header.t != '#commit':
return
commit = parse_subscribe_repos_message(message)
if len(commit.ops) == 0:
return
op = commit.ops[0]
if (
(op.action == "create") and
op.path.startswith("app.bsky.feed.post/")
):
# Do stuffHowever this shows ~6-7k posts for some users just over the past day which seems like a lot if I go scroll through their actual profiles... For some users that is >10% of their total post count according to the bsky UI. Is there something other than posts/replies that would make it through that filter that I'm not accounting for? |
Replies: 1 comment
|
Hi, check this one! You need to parse URI (line 26) and access to the collection (line 41) atproto/examples/firehose/process_commits.py Lines 21 to 41 in 91e0335 so the resulting code should be something like this: from atproto import CAR, AtUri, models
uri = AtUri.from_str(f'at://{commit.repo}/{op.path}')
if op.action == 'create' and uri.collection == models.ids.AppBskyFeedPost: ... # do stuff |
Hi, check this one! You need to parse URI (line 26) and access to the collection (line 41)
atproto/examples/firehose/process_commits.py
Lines 21 to 41 in 91e0335