Created
April 30, 2024 23:07
-
-
Save lizzybrooks/f0ea08f6580eeeb7197d1dd2208e3abb to your computer and use it in GitHub Desktop.
This file contains 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
const axios = require('axios'); | |
const cheerio = require('cheerio'); | |
async function fetchAndParseURL(url) { | |
try { | |
const response = await axios.get(url); | |
const $ = cheerio.load(response.data); | |
const eventsToday = []; | |
$('.fsCalendarToday .fsCalendarEventTitle').each((i, elem) => { | |
eventsToday.push($(elem).text().trim()); | |
}); | |
console.log('Events for today:', eventsToday); | |
} catch (error) { | |
console.error('Error fetching or parsing the page:', error); | |
} | |
} | |
// Replace 'http://example.com' with the actual URL | |
fetchAndParseURL('https://www.lwhs.org/calendar1'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment