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

garmin-connect-scraper

v1.1.1

Published

Incremental Puppeteer based Garmin Connect scraper

Downloads

14

Readme

garmin-connect-scraper

npm

Incremental Puppeteer based Garmin Connect™ scraper.

Install

npm i garmin-connect-scraper

Usage

Minimal usage:

garmin-connect-scraper [email protected] --password=secret

This will download all your activities as activities.json file into current folder.

To change the default download path or to download additional data, use config files (see configuration section below):

garmin-connect-scraper --config=myconfig.json [email protected] --password=secret

Usage example: https://github.com/evg656e/garmin-routines-updater

Configuration

{
    // some general options
    "general": {
        // delay (in milliseconds, 5000 default) to download data 
        // the smaller the number, the faster the data will be downloaded, but you will probably get a timeout penalty from garmin site (reduce on your own risk)
        "requestDelay": 3000,
        // default pick policy (possible values are "notNull" or "all")
        // by default all properties are picked, changing to "notNull" will skip properties with null values 
        "defaultPickPolicy": "notNull",
        // specifies base directory that can be used in file paths lookups
        // the lookup syntax is {varName}, some default lookup variables are available:
        // cwd - current working directory (default)
        // homeDir - system home directory
        // currentDate - date part of current datetime in ISO format
        // currentTime - time part current datetime in ISO format
        "baseDir": "{homeDir}/sports"
    },
    // you can save your credentials here not to pass it through CLI every time (not a good idea though)
    "credentials": {
        "username": "[email protected]",
        "password": "secret"
    },
    // data retrieval section
    "activities": {
        "search": {
            // search parameters as they used on https://connect.garmin.com/modern/activities page
            // for example, to retrieve all swimming activities, specify:
            "parameters": {
                "activityType": "swimming",
                "activitySubType": "lap_swimming"
            },
            // limits the number of activities retrieved (unlimited by default, so that all activities will be retrieved)
            "limit": 100,
            // path to file where to save activities
            // this file will be used on the next program invocations to retrieve only new activities
            // default lookup variables (сwd, homeDir or baseDir) are available
            "path": "{baseDir}/lap_swimming/index.json",
            // explicitly sets the set of properties to retrieve from activities
            // it is possible to rename properties using syntax "name as newName"
            // it is possible to use nested properties using syntax "parent.childName as newName" (when using nested properties renaming is mandatory)
            // example (only 4 data fields will be picked for each activity):
            "pick": [
                "activityId",
                "activityName",
                "startTimeLocal as startTime",
                "activityType.typeKey as activityTypeKey"
            ]
        },
        // additional data retrievals
        // you can specify additional data to be retrieved per activity
        // for example, by this, splits and activity details will be downloaded for each retrieved activity from the "search" section
        "fetch": [
            {
                // data url to be retrieved
                // you can use activity's properties as lookups
                "url": "https://connect.garmin.com/modern/proxy/activity-service/activity/{activityId}/splits",
                // path to file where to save data
                // you can use default variables (e.g. cwd, homeDir or baseDir) and current activity's properties (e.g. activityId) as lookups in this path
                "path": "{baseDir}/lap_swimming/splits/{activityId}.json"
                // "pick" property as mentioned above is available here
            },
            {
                "url": "https://connect.garmin.com/modern/proxy/activity-service/activity/{activityId}",
                "path": "{baseDir}/lap_swimming/activity/{activityId}.json"
            }
        ]
    }
}

The configuration file must be valid JSON file, so be sure to remove the comments, if you use this snippet.

Links

Some other similar projects:

  • https://github.com/fsrc/agcs/blob/master/lib/garmin-connect.ls
  • https://github.com/pe-st/garmin-connect-export/blob/develop/gcexport.py