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

kaggle-node

v1.1.2

Published

NodeJS Library for Kaggle API

Downloads

12

Readme

kaggle-node

NodeJS Library for Kaggle API, accessible via npm.

Installation

npm i kaggle-node

Development

Authenticate

Authenticating is only needed to access public resources requiring user consent or private resources.

First, you will need a Kaggle account. You can sign up here.

After login, you can download your Kaggle API credentials at https://www.kaggle.com/settings by clicking the "Create New Token" button under the API section.

{"username": YOUR_USERNAME,"key": YOUR_KEY}

Usage

Import and create KaggleNode object.

import { KaggleNode } from 'kaggle-node';

let kaggleNode = new KaggleNode({
  credentials: {
      username: YOUR_USERNAME,
      key: YOUR_KEY
  }
});

Datasets

Search datasets.

let res = await kaggleNode.datasets.search();

/**
Filter search.
  'sortBy' - Apply Kaggle sorting criteria, default 'HOTTEST'.
  'fileType' - Filter by associated file type.
  'license' - Filter by license.
  'search' - Filter by keyword search.
  'tagIds' - Filter by tags.
  'username' - Filter by Kaggle user account.
  'page' - API pagination, pagesize of 20.
  'minSize', 'maxSize' - Filter by bytesize.
**/

let res = await kaggleNode.datasets.search({
  sortBy: DatasetQuerySorting.UPDATED,
  fileType: DatasetQueryFileTypes.JSON,
  license: DatasetQueryLicenses.GPL,
  search: "tools",
  tagIds: [4141, 1070],
  username: 'rashadrmammadov',
  page: 2,
  minSize: 10,
  maxSize: 1000000
} as DatasetQueryOptions);

To learn more about filtering options, check out DatasetQueryEnums.ts.

To interact with datasets, use the associated handle string. This can be found from parsing the dataset's URL or accessing the ref property within a dataset search response.

If you would like to specify versioning, append a versions clause followed by the version number. To learn about a dataset's versioning, navigate to "Data Explorer" on the right-hand side of the dataset's web page or preview the dataset.

Consider https://www.kaggle.com/datasets/jessicali9530/animal-crossing-new-horizons-nookplaza-dataset.

let handleStr;

handleStr = 'jessicali9530/animal-crossing-new-horizons-nookplaza-dataset';
handleStr = 'jessicali9530/animal-crossing-new-horizons-nookplaza-dataset/versions/2';

Preview datasets.

let res = await kaggleNode.datasets.view(handleStr); // application/json

List datasets' files.

let res = await kaggleNode.datasets.list(handleStr); // application/json

Download an entire dataset.

let res = await kaggleNode.datasets.download(handleStr); // application/zip

Download a specific file within a dataset.

let res = await kaggleNode.datasets.download(handleStr, "accessories.csv"); // text/csv

Common MIME types for file responses

Roadmap

To Do

  • [X] Datasets
  • [ ] Notebooks
  • [ ] Colab

Contributions to this repo are welcome. This library is based off Kaggle's official API repos. I advise referencing them for new implementation, to keep functionality standard.

References

https://github.com/Kaggle/kaggle-api

https://github.com/Kaggle/kagglehub/tree/main

License

kaggle-node is released under the ISC license.