Skip to content

Instantly share code, notes, and snippets.

@gixxerblade
Last active August 23, 2021 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gixxerblade/fd55680f0e9d58b7001358a5898de9aa to your computer and use it in GitHub Desktop.
Save gixxerblade/fd55680f0e9d58b7001358a5898de9aa to your computer and use it in GitHub Desktop.
Converts ical ics file to json for a Meetup Google subscribed calendar
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