@payw/cau-food-scraper
v2.0.6
Published
A CAU restaurant menu scraper for Node.js
Downloads
7
Readme
CAU Food Scraper (CAUFS)
A CAU restaurant menu scraper for Node.js
NOTE: You should follow the migration guide in favor of v2 release.
What's new in v2
- 🎯 Promise-based precise data scraping without any wasting of time
- 🚀 Boost up to 5x faster
- 🗑 Reduce dependencies which are totally unnecessary
Installation
npm install @payw/cau-food-scraper
# OR
yarn add @payw/cau-food-scraper
Usage
// Node.js
const { CAUFS } = require('@payw/cau-food-scraper')
// webpack
// import { CAUFS } from '@payw/cau-food-scraper'
CAUFS({
id: 'portalId',
pw: 'portalPw',
days: 1 // optional (default: 5)
}).then(data => {
// Do something
})
Migration from v1 to v2
You should import the library differently.
/* v1 */
// Node.js
const foodScrape = require('@payw/cau-food-scraper').default
// webpack
import foodScrape from '@payw/cau-food-scraper'
/* v2 */
// Node.js
const { CAUFS } = require('@payw/cau-food-scraper')
// webpack
import { CAUFS } from '@payw/cau-food-scraper'
Currently, the chage below is deprecated and will be reverted back on the next major release.
Returning data type of Day
and its children types had been slightly changed. The package includes a type definition with more detailed information.
/* v1 */
type Day = {
date: string
breakfast: Food[]
lunch: Food[]
supper: Food[]
}
/* v2 */
type Day = {
date: string
timeGroup: {
breakfast: Restaurant[]
lunch: Restaurant[]
supper: Restaurant[]
}
}