require 'httparty' require 'nokogiri' require 'time' URL = "https://tangled.org/did:plc:3qvnhzaejch2aycm6gnu7rma/blog/issues" AGENT = { "User-Agent" => "Mozilla/5.0" } res = HTTParty.get(URL, headers: AGENT) return puts "Failed: #{res.code}" unless res.success? doc = Nokogiri::HTML(res.body) issues = doc.css("div.rounded.drop-shadow-sm.bg-white").filter_map do |node| link = node.at_css("a.no-underline") time = node.at_css("span time") next unless link && time date = Time.iso8601(time['datetime']).strftime("%b %-d, %Y") title = link.text.split('#').first.strip "#{date} [#{title}](https://tangled.org#{link['href']})" end content = "beware! informal ramblings and disorganized notes abound, also only the last 30 posts are listed below.\n\n" + issues.join("\n\n") File.write("README.md", content) puts "Done!"