Something went wrong. Try again.
Documentation website about Ruby gems for ATProto ruby.sdk.blue
atprotocol bluesky ruby atproto
Something went wrong. Try again.
895 B · 30 lines
Ruby
at master
12345678910111213141516171819202122232425262728293031#!/usr/bin/env ruby
# Example: load last 10 posts from the popular "Science" feed and print the post text,# data and author handle to the terminal. Does not require any authentication.
require 'bundler/setup'require 'minisky'require 'time'
# the "Science" custom feed by @bossett.bsky.socialFEED_URI = "at://did:plc:jfhpnnst6flqway4eaeqzj2a/app.bsky.feed.generator/for-science"
appview = Minisky.new('api.bsky.app', nil)feed = appview.get_request('app.bsky.feed.getFeed', { feed: FEED_URI, limit: 10 })posts = feed['feed'].map { |x| x['post'] }
posts.each do |post| handle = post['author']['handle'] timestamp = Time.parse(post['record']['createdAt']).getlocal rkey = post['uri'].split('/').last
link = "https://bsky.app/profile/#{handle}/post/#{rkey}"
puts "@#{handle} • #{timestamp} • #{link}" puts puts post['record']['text'] puts puts "=" * 120 putsend