Skip to content

Instantly share code, notes, and snippets.

@mieky
Created February 16, 2017 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mieky/373efb5252cf140c80e63155836d4a05 to your computer and use it in GitHub Desktop.
Save mieky/373efb5252cf140c80e63155836d4a05 to your computer and use it in GitHub Desktop.
// npm install --save axios cheerio
const axios = require('axios');
const cheerio = require('cheerio');
const fetchEvents = () => {
return axios.get('https://www.luuppi.fi')
.then((response) => {
const $ = cheerio.load(response.data);
return $(".tapahtuma_otsikko a")
.map((i, el) => $(el).text())
.get()
.join("\n");
});
}
module.exports = {
fetchEvents
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment