npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

movie-diversity-cli

v2.1.0

Published

A CLI for determining the gender diversity of a movie

Downloads

14

Readme

Movie Gender Diversity CLI

This is a CLI tool for determining the breakdown by gender of a movie. I grab the data from the Movie DB, a website similar to IMDB but with an API.

How to use it

You can install the application globally on your system from npm with the command npm install movie-diversity-cli -g.

Then to actually use the script you can call it by movie-diversity get "movie name". If you're searching for a movie with multiple words in the title you'll need to surround the title with quotes.

Here's an example response you might get:

You can also get a random movie by movie-diversity random. Omitting arguments to the function will also result in this call.

If you don't want to install it globally you can use npx to create a temporary install: npx movie-diversity-cli.

How it works

The process of creating an 'analysis' kicks off with a movie title. This title is fed into the MovieDB search API after which the bot selects the first movie listed. Once there is a movie associated with the request, the program grabs the cast members and aggregates the genders of the first 20 cast members.

This is done in an Amazon Lambda function. You can see code for that process under lambda/. If you want to run the Lambda code yourself, you'll need to grab your own API key from the MovieDB.

The cast members are billed according to importance, so choosing the top 20 should lead to a accurate study, as minor characters with little screen time are not as relevant (though definitely still important!) The output distribution is then displayed to the user.

For picking a random movie the program makes a call to a Datasette JSON API with a list of a 100 popular movies. From there it filters the list to only movies from after 1975, in order to make sure that we have enough data for an analysis. It then picks a random movie from that list and feeds it into the main function.

The future

  • Expand analysis to include ethnicity information as well, in addition to other groups
  • Have more detailed error messages, including ones for when the movie was actually found, but did not have enough cast members for an analysis

Credits

I'd like to thank Tim Pettersen for their tutorial on how to build a CLI tool in Node, The Movie DB for providing such a useful API, and Carbon for providing an easy way to create instruction images.