Skip to content

Getting school details

Michał Oręziak edited this page Jun 12, 2019 · 1 revision
const { 
    WARSAW_AFTER_SECONDARY_SCHOOL_URL
    } = require('@warsawlo/lava/urls/2019')

const Lava = require('./src/Lava')({
  baseURL: WARSAW_AFTER_SECONDARY_SCHOOL_URL
});

(async () => {
  const school = new Lava.School({
    id: 104
  })
  await school.load()

  school.getDescription()
  school.getClasses()
  school.getAdditionalInfo()
})()

What's going on here?

  1. Instance of Lava is created
  2. Instance of School is created. You have to pass object with id of school taken from search results.
  3. School website is downloaded under the hood & cheerio object is created.
  4. You have access to data thru functions such as getDescription(), getClasses(), getAdditionalInfo()
Clone this wiki locally