Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.