main dots / scripts / Scripts / yaml_check_urls
xxwhirlpool  ·  2026-05-21
 1#!/usr/bin/env ruby
 2#
 3# ping the URLs in my site's blogroll & see if they're alive
 4# only run this once in a while ig
 5
 6require "yaml"
 7require "net/http"
 8require "uri"
 9
10yml = YAML.load_file("/home/kat/Projects/mine/eunoia-astro/src/content/blogroll/blogs.yml")
11
12yml.each do |y|
13	uri = URI(y["url"])
14
15	begin
16		res = Net::HTTP.get_response(uri)
17		case res.code.to_i
18			when 200
19				puts "success: #{uri}"
20			else
21				res.code
22			end
23		rescue SocketError, OpenSSL::SSL::SSLError, Net::ReadTimeout, Net::OpenTimeout => e
24			puts "error: #{uri} - #{e}"
25		end
26end
27