Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reto #18 - javascript #4932

Merged
merged 3 commits into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Retos/Reto #18 - WEB SCRAPING [Difícil]/javascript/Pancratzia.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* El día 128 del año celebramos en la comunidad el "Hola Mundo day"
* Vamos a hacer "web scraping" sobre su sitio web: https://holamundo.day
*
* Crea un programa que se conecte a la web del evento e imprima únicamente la agenda de eventos
* del día 8. Mostrando hora e información de cada uno.
* Ejemplo: "16:00 | Bienvenida"
*
* Se permite utilizar librerías que nos faciliten esta tarea.
*
*
*
* HECHO POR PANCRATZIA - 07/09/2023
*/


import puppeteer from "puppeteer";

async function webScraping(url) {
const browser = await puppeteer.launch({
headless: false,
slowMo: 400
});
const page = await browser.newPage();
await page.goto(url);
const result = await page.evaluate(() => {
const blockquotes = document.querySelectorAll("blockquote");
const data = [...blockquotes].slice(21,).map(blockquote => {
const time = blockquote.innerText
return time

})
return data
})
console.log(result.join('\n'))
await browser.close()
}

webScraping("https://holamundo.day")