Skip to content

Instantly share code, notes, and snippets.

@rylev
Created July 22, 2019 14:48
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 rylev/998c1f811d044e06fb37e8680dac31e7 to your computer and use it in GitHub Desktop.
Save rylev/998c1f811d044e06fb37e8680dac31e7 to your computer and use it in GitHub Desktop.
Top Windows Crates
require "open-uri"
require "json"
PAGE_SIZE=100
NUM_PAGES=1
crates = (1..NUM_PAGES).flat_map do |page|
res = JSON.parse(URI.parse("https://crates.io/api/v1/crates?keyword=windows&page=#{page}&per_page=#{PAGE_SIZE}").read)
res["crates"].map {|c| {name: c["name"], repo: c["repository"]} }
end
p crates.map {|c| c[:name] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment