#download #crates #check

downloads

All My Crates Downloads

2 releases

0.0.2 Aug 29, 2019
0.0.1 Aug 29, 2019

#248 in Visualization

MIT/Apache

9KB

downloads-rs Build Status crate

WIP
A lib for check my-crates all downloads.

Usage

Add dependencies

[dependencies]
downloads = "0.0.2"

Example

extern crate downloads;
use downloads::*;

fn main() {
    let mut totals = 0;
    let user_id = "56717";
    let v: Result<Value> = fetch(user_id);
    if let Ok(x) = v {
        if let Some(arr) = x.as_array() {
            for i in arr {

                println!("crate name: {}", i["name"]);
                println!("downloads: {}",i["downloads"]);
                println!("\n");
                totals += i["downloads"].as_u64().unwrap() as usize;
            }
        }
    }

    println!("Total Downloads: {}", totals);
}

Find UserID

Steps

  1. Open https://crates.io
  2. Login
  3. Open Chrome, More Tools -> Developer Tools, select Network Tab, then refresh
  4. Finally, find something like crates?user_id=56717, double click, will see all your user info.

Dependencies

~8–15MB
~224K SLoC