How to read the "Discover" Feed? #407
-
Hello, I am trying to read the Discover fead for a bot functionality. If you do it by hand in a browser, it is this URL: https://bsky.app/profile/did:plc:z72i7hdynmk6r22z27h6tvur/feed/whats-hot But I was not able to do this by atproto. Basically, the Discover feed is a (dynamic) feed generated by the bsky.app user. But atproto complains about the AT proto syntax when I try to read this by get_posts(...). Or, if it does not complain the bsky server answers with a 502 error. Can somebody help me in reading the Discover feed ? My best regards, Matthias |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello, from atproto import Client, models
def main() -> None:
client = Client()
client.login('handle', 'password')
discover_feed_uri = 'at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/whats-hot'
feed_response = client.app.bsky.feed.get_feed(models.AppBskyFeedGetFeed.Params(feed=discover_feed_uri))
for post_view in feed_response.feed:
author = post_view.post.author.handle
text = post_view.post.record.text.replace('\n', ' ')
print(f'{author}: {text}') Keep in mind that you need to implement pagination using |
Beta Was this translation helpful? Give feedback.
Hello,
Keep in mind that you need to implement pagination using
feed_response.cursor
if you want to fetch more posts. Here is the example