Created
July 22, 2019 14:48
-
-
Save rylev/998c1f811d044e06fb37e8680dac31e7 to your computer and use it in GitHub Desktop.
Top Windows Crates
This file contains hidden or 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
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