Last active
August 3, 2022 22:54
-
-
Save Archenoth/8bdebe84c523233339b5 to your computer and use it in GitHub Desktop.
/r/nocontext fortune -- Fetches a random /r/nocontext title as the fortune
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'nokogiri' | |
require 'net/http' | |
http = Net::HTTP.new("old.reddit.com", 443) | |
http.use_ssl = true | |
get = Net::HTTP::Get.new("/r/nocontext/", { | |
'User-Agent' => 'A fortune script that returns random /r/nocontext titles (Without context of course) (By /u/archenoth)' | |
}) | |
puts Nokogiri.parse(http.request(get).body).css("a.title").to_a.sample.text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment