Created
February 16, 2017 12:10
-
-
Save mieky/373efb5252cf140c80e63155836d4a05 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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