kehittamo / oluttamo-api

Simple API that serves our oluttamo-browser-extensions
MIT License
0 stars 1 forks source link

Parse beer rating data from ratebeer and add it to the beers collection #2

Open 0is1 opened 8 years ago

0is1 commented 8 years ago

At the moment it's not possible to show ratebeer.com page in the iframe if web page uses https because it violates Content Security Policy (ratebeer.com does not support https). This can be one solution to use Oluttamo also in https-pages.

Idea:

  1. Loop and scrape ratebeer.com/beer/ID/ -pages
  2. Get overall and style rating + maybe beer style from html
  3. Add data to beer info
  4. Serve data to oluttamo-browser-extension

Updated schema could look like:

const BeerSchema = new mongoose.Schema({
    breweryName: {
        type: String,
        required: true,
    },
    beerName: {
        type: String,
        required: true,
    },
    beerFullName: {
        type: String,
        required: true,
        index: true,
    },
    ratebeerId: {
        type: String,
        required: true,
        index: true,
    },
    overallRating: {
        type: Number,
        required: true,
    },
    styleRating: {
        type: Number,
        required: true,
    },
    beerStyle: {
        type: String,
        required: true,
    },
    createdAt: {
        type: Date,
        default: Date.now,
    },
});

If we do like this, it's possible to show some information about the beer even user is on https://-page. Of course ratings need also update once in a while. That also enables settings like "Show only beers that have overall rating > 80" etc.

0is1 commented 8 years ago

Actually https works in ratebeer.com like https://www.ratebeer.com/beer/SOMEPREFIX/BEERID/. So this isn't necessary enchancement. Even though this still could enable some cool settings, like "Show only beers that have overall rating > 80"