Code Monkey home page Code Monkey logo

beer's Introduction

Finding beer in new (to you) styles

These scripts are finding new beers from your local beershop. You need to have two things be true for this to work:

  1. You record your unique beers in untappd
  2. You consider "new beers" being beers from a style you've not had before. There are 224 different styles of beer on untappd but it's really hard to see how a beer is classified just by looking at the can.
  3. Your local puts their beers on untappd too
  4. You're comfortable with some JS scripting.

Usage

After you have followed the setup you can run the following script to get a CSV that you can print or take into the shop. The first argument to the script be the path to the shop data you

node src/missing-styles.js src/data/hopheads-point-cook.json
open out/shopping-list-hopheads-point-cook.csv

Setup

Instal deps

npm i

Get your beer data

  1. https://untappd.com/user/distributedlife/beers
  2. Keep clicking the "Load More" page until you have all your beers or the beers since last extract
  3. Open console and run the script below to convert data to JSON
  4. Save the file in src/data/beers.json
JSON.stringify(
  $$(".beer-item").map((c) => {
    return {
      name:
        c.querySelector(".beer-details .name a") && c.querySelector(".beer-details .name a").text,
      brewery:
        c.querySelector(".beer-details .brewery a") &&
        c.querySelector(".beer-details .brewery a").text,
      style:
        c.querySelector(".beer-details .style") &&
        c.querySelector(".beer-details .style").textContent.trim(),
      date:
        c.querySelector(".details .date a abbr") &&
        c.querySelector(".details .date a abbr").textContent.trim(),
    };
  })
);

Beershop Data

I chatted with peeps at Hopheads (a local beer shop near me) and they said that they add beers more readily than when they take them off from being out of stock. You may end up with some beers that are no longer available.

  1. Find your beershop on Untappd e.g.
  2. Filter by newest first and hide beers you've had
  3. Keep clicking the "Load More" page until you have all your beers or the beers since last extract
  4. Open console and run the script below to convert data to JSON
  5. Save the file in src/data/shopname.json where shopname is the name you use for the shop

Data I have already

  1. https://untappd.com/v/hopheads/2887575 -> src/data/hopheads-point-cook.json
  2. https://untappd.com/v/hopheads-altona/8072907 -> src/data/hopheads-altona.json
  3. https://untappd.com/v/hopheads-yarraville/10442156 -> src/data/hopheads-yarraville.json
JSON.stringify(
  $$(".sorting-item").map((c) => {
    return {
      name:
        c.querySelector(".beer-info .beer-details h5 a") &&
        c.querySelector(".beer-info .beer-details h5 a").text,
      brewery:
        c.querySelector(".beer-info .beer-details h6 a") &&
        c.querySelector(".beer-info .beer-details h6 a").text,
      style:
        c.querySelector(".beer-info .beer-details h5 em") &&
        c.querySelector(".beer-info .beer-details h5 em").textContent.trim(),
      prices: [...c.querySelectorAll(".beer-prices p")].map((d) => {
        return {
          size: d.querySelector(".size").textContent.trim(),
          price: d.querySelector(".price").textContent.trim(),
        };
      }),
    };
  })
);

beer's People

Contributors

distributedlife avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.