Created
June 5, 2018 16:44
-
-
Save sergiolucero/85230d18152d7cceb59ad6dae47acb0a to your computer and use it in GitHub Desktop.
Primer deployment serverless en Amazon Lambda
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
| 'use strict'; | |
| module.exports.hello = (event, context, callback) => { | |
| const response = { | |
| statusCode: 200, | |
| body: JSON.stringify({ | |
| message: 'hola Sergio!', | |
| }), | |
| }; | |
| callback(null, response); | |
| }; |
Donde el código importado vía const {extractListingsFromHTML} = require('./helpers') es
const cheerio = require('cheerio');
const moment = require('moment');
function extractListingsFromHTML (html) {
const $ = cheerio.load(html);
const urls = $('div.listing-item__header');
urls.each((i, el) => {
let url = $(el).children('a.').first().href().trim();
vacancies.push({url});
});
return vacancies;
}
Pero obviamente escrito en JavaScript correcto!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lo que me gustaría hacer es correr una función que haga el scraping de una página (pasándole un id)