Last active
August 23, 2021 19:57
-
-
Save gixxerblade/fd55680f0e9d58b7001358a5898de9aa to your computer and use it in GitHub Desktop.
Converts ical ics file to json for a Meetup Google subscribed calendar
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 nodeFetch = require("node-fetch") | |
const ical = require("ical2json") | |
const main = async (fileLocation) => { | |
const icsRes = await nodeFetch(fileLocation) | |
const icsData = await icsRes.text() | |
const data = ical.convert(icsData) | |
const myEvents = data.VCALENDAR[0].VEVENT.map(event => ({ | |
startTime: event.DTSTART, | |
endTime: event.DTEND, | |
url: event.URL, | |
description: event.DESCRIPTION, | |
location: event.LOCATION, | |
title: event.SUMMARY, | |
id: event.UID | |
})) | |
console.log(myEvents) | |
} | |
main('https://calendar.google.com/calendar/ical/<YOUR GOOGLE CALENDAR ID>/public/basic.ics') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment