Git Product home page Git Product logo

turnip-bot's Introduction

๐Ÿง„ 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 15)
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)

turnip-bot's People

Contributors

anthonykrivonos avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

anthonybaldwin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.