tiny-rebel-web-scraper
v1.0.5
Published
Web scraper for getting beer information from the Tiny Rebel beer board
Downloads
3
Readme
Tiny Rebel web scraper
A small library for querying available drinks at Tiny Rebel bars
Basic usage
npm install tiny-rebel-web-scraper
const tinyRebelWebScraper = require('tiny-rebel-web-scraper');
// Bar location should be specified as "cardiff" or "newport"
tinyRebelWebScraper.getAllDrinks('cardiff')
.then((drinks) => {
for (const drink of drinks) {
console.log(`${drink.name}: ${drink.formattedPrice}`);
}
})
.catch((error) => {
// Failed to load what drinks are available
console.error(error);
throw error;
});
API
getAllDrinks
Get all drinks at the specified bar.
Method signature
getAllDrinks (barLocation: string): Promise<Drink[]>
getAllKegDrinks
Get all keg drinks at the specified bar.
Method signature
getAllKegDrinks (barLocation: string): Promise<Drink[]>
getAllCaskDrinks
Get all cask drinks at the specified bar.
Method signature
getAllCaskDrinks (barLocation: string): Promise<Drink[]>
Return values
The API will return an array of Drink
objects, i.e. POJOs with the following properties.
// Drink
{
abv: 4.2,
available: true,
brewery: 'Tiny Rebel Brewing Co. (Newport, South Wales)',
cask: true,
currency: 'GBP',
formattedAbv: '4.2%',
formattedPrice: '£3.30',
keg: false,
name: 'You Snows It',
price: 3.3,
quantity: 'pint',
style: 'Pale Ale',
vegan: false
}
Note: Pricing information for drinks will not always be available, in which case the price
will be reported as null
and the formattedPrice
will be reported as 'Unknown'
.