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 🙏

© 2025 – Pkg Stats / Ryan Hefner

matty

v0.1.0

Published

fetch MLB gameday data

Downloads

4

Readme

matty: fetch MLB gameday data

matty is a command-line tool and Node library for crawling the MLB Gameday web site. Both the command-line tool and library are unstable -- they're continuing to evolve with no intention of maintaining compatibility.

There are a number of other tools for collecting this data, most based on "hack_28_spider.pl". Matty exists because I found the performance and robustness wanting in the existing tools.

matty is not created or approved by MLB. Crawlers can have a significant performance impact on servers. Use responsibly, and at your own risk.

Synopsis

$ matty sample.json
Loaded configuration.
  year_2013/month_05/day_01/
  year_2013/month_05/day_01/gid_2013_05_01_sfnmlb_arimlb_1/
  ...
Finished crawl (74 requests, 17042 ms)

All parameters are specified by the JSON file specified by the first argument.

Configuration

You must specify the start, end, and output properties:

  • start: any timestamp accepted by Date.parse() that denotes the first day's games you want to start crawling.
  • end: any timestamp accepted by Date.parse() that denotes the last day's games you want to start crawling. (Games on end will be included.)
  • output: root of directory tree in which to store output.

There are a few properties whose defaults are probably fine, but which you may want to tweak:

  • concurrency: Number of concurrent connections to use. You are strongly discouraged from setting concurrency > 1, since this can cause excessive load on the server.
  • file_match: Array of regular expression patterns to test against filenames that would be fetched. Files fetched must match at least one of these expressions. The default patterns grab basic game summary data and the per-inning pitch data.
  • match_all: Array of regular expression patterns to test against both directories and files. Directories and files not matching all of these patterns will be skipped. The default contains no patterns, but this control allows you to easily crawl data for only a single team.

If you override these built-in parameters, your top-level value completely replaces the default. If you want to add your own "file_match" patterns and still use the default ones as well, you need to explicitly specify both your own and the defaults, since the ones you specify will replace the defaults.

There are a few other properties that you'll likely never need to change:

  • server: HTTP server where the source data is hosted.
  • root: Path on the server to start crawling.

Example

Here's an example file that crawls all SF Giants games from 5/1/2013 to 5/10/2013, putting the output into a directory called "out":

{
        "start": "2013-05-01",
        "end": "2013-05-01",
        "output": "./out",
        "match_all": [ "_sfnmlb_" ]
}

Matty?

The Christian Gentleman, of course.

TODO

  • figure out the right delay between requests