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

turnip-bot

v1.0.7

Published

Track turnip prices for Animal Crossing: New Horizons!

Downloads

27

Readme

🧄 turnip-bot

Scrape Reddit for the best Turnip prices in Animal Crossings: New Horizons!

Disclaimer: Use at your own discretion. This code is licensed under the MIT license (see LICENSE.md) and is free for anyone to use or modify. All authors of this package are removed of any liabilities concerning usage of turnip-bot.

🐗 Usage (NPM)

npm install turnip-bot --save

import { subscribeToNewPosts, Post } from 'turnip-bot`

// Should the bot log its progress? It's helpful to do so.
const verbose = true

// Polling interval in seconds (min 20)
const pollingInterval = 30

// Called whenever a new post is scraped
const onNewPost = (post:Post) => {
    console.log('Got new post')
    console.log(post)
}

subscribeToNewPosts(onNewPost, pollingInterval, verbose)

🦝 Usage (Local)

  1. Clone the repo.
git clone https://github.com/anthonykrivonos/turnip-bot.git
  1. Install dependencies.
cd turnip-bot && npm install
  1. Run turnip-bot! The following will save the scraper result to ./dist/data/my_database.json every 30 seconds.
npm run reddit my_database 30

You can also simply call the following, which will save the scraper result to ./dist/data/reddit_database.json every 15 seconds.

npm run reddit

🔷 Output Shape

The result is always returned as a Post object.

Post

  • id (string): The unique ID of the post.
  • type ('buy'|'sell'): buy denotes that the Nooklings are buying turnips, while sell denotes that Daisy Mae is selling turnips.
  • price (number): The price of the turnips, in bells.
  • url (string): A direct link to the post.
  • title (string): The original title of the post.
  • body (string?): The unformatted body of the post.
  • poster (Poster): The original poster (OP).

Within a Post object is an object called Poster, which contains information on the user who made the post.

Poster

  • username (string?): The OP's username on the platform the information was scraped from.
  • friendCode (string?): The OP's Nintendo Switch friend code
  • profileUrl (string?): The link to the OP's profile on the platform the information was scraped from.
  • acName (string?): The OP's name in Animal Crossing: New Horizons.
  • acIslandName (string?): The OP's island name in Animal Crossing: New Horizons.

Author

Anthony Krivonos (Portfolio | LinkedIn)