fedi-who 650 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env ruby
  2. #from sev apparently, according to p
  3. %w(
  4. json
  5. openssl
  6. net/http
  7. uri
  8. ).each &method(:require)
  9. ARGV.each { |host|
  10. data = JSON.parse(Net::HTTP.get(URI("https://#{host}/api/v1/instance")))
  11. admin = begin
  12. "#{data['contact_account']['url']}"
  13. rescue NoMethodError
  14. end
  15. if !admin
  16. begin
  17. suppl = JSON.parse(Net::HTTP.get(URI("https://#{host}/nodeinfo/2.0.json")))
  18. admin = suppl.dig('metadata', 'staffAccounts').inspect
  19. rescue
  20. end
  21. end
  22. puts "- #{data['uri']} — #{(data['title'] || data['description']).inspect}",
  23. "\temail: #{data['email']}",
  24. "\tadmin: #{admin}",
  25. "\tstats: #{data['stats'].to_json}",
  26. ''
  27. }