Skip to content

Instantly share code, notes, and snippets.

@aapris
Last active September 3, 2016 16:02
Show Gist options
  • Save aapris/9164f80f95cf668c0eaed45d8abafd84 to your computer and use it in GitHub Desktop.
Save aapris/9164f80f95cf668c0eaed45d8abafd84 to your computer and use it in GitHub Desktop.
Pretty print your Foursquare history
# Pretty print your Foursquare history
# remember to "pip install requests ics" into you virtualenv
import sys
import requests
from ics import Calendar
ics_data = requests.get(sys.argv[1]).text
cal = Calendar(ics_data)
for e in cal.events:
print("{} | {}".format(e.begin.format('YYYY-MM-DD HH:mm:ss ZZ'), e.name.lstrip('@ ')))
"""
Usage:
python pretty_4sq.py https://feeds.foursquare.com/history/YOUR_SECRET_FOURSQUARE_FEED_URL.ics?count=50
2016-08-30 12:59:00 -00:00 | HSL 0099 Kauppatori (Suomenlinnan lautan terminaali)
2016-08-30 12:59:00 -00:00 | HSL Suomenlinnan lautta M/S Suokki
2016-08-30 13:15:00 -00:00 | Suomenlinna / Sveaborg
2016-08-30 13:18:00 -00:00 | Pikku-Mustasaari
2016-08-30 13:21:00 -00:00 | Merisotakoulu
2016-08-30 13:31:00 -00:00 | Iso Mustasaari
2016-08-30 14:14:00 -00:00 | Suomenlinnan uimaranta
2016-08-30 14:22:00 -00:00 | Piperin Puisto
2016-08-30 14:23:00 -00:00 | Cafe Piper
2016-08-30 14:36:00 -00:00 | Suomenlinnakeskus / Visitor Centre
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment