Skip to content

Instantly share code, notes, and snippets.

@Lomanic
Created March 21, 2022 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lomanic/11ad8f534c96e56b47e85a227397187f to your computer and use it in GitHub Desktop.
Save Lomanic/11ad8f534c96e56b47e85a227397187f to your computer and use it in GitHub Desktop.
Download previous words from sutom.nocle.fr
require 'base64'
require 'date'
require 'open-uri'
# https://github.com/pil0u/sutom-tob/commit/263e26ec15019f1f41582dc3480b54c2d23266af
def uri_mot_sutom(jour)
origine = Date.new(2022, 1, 7)
aujourdhui = origine + jour
s = "34ccc522-c264-4e51-b293-fd5bd60ef7aa-#{aujourdhui}"
s_enc = Base64.encode64(s).gsub("\n", '')
"https://sutom.nocle.fr/mots/#{s_enc}.txt"
end
for i in 1..74 do
URI.open(uri_mot_sutom(i)) do |txt|
File.open("./#{"%04d" % i}.txt", "wb") do |file|
file.write(txt.read)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment