Is it possible to export my location history from Foursquare?
Here's a Python script that will export your entire checkin history using the Foursquare API.
- import requests
- import json
- url_template = 'https://api.foursquare.com/v2/users/self/checkins?limit=250&oauth_token={}&v=20131026&offset={}'
- token = "" # replace with oauth token
- offset = 0
- data = []
- with open("/tmp/checkins.json", 'w') as f:
- while True:
- response = requests.get(url_template.format(oauth_token, offset))
- if len(response.json()['response']['checkins']['items']) == 0:
- break
- data.append(response.json())
- offset += 250
- f.write(json.dumps(data))
Source: https://gist.github.com/dlo/7177249
If you don't already have an oauth token available, visit the Foursquare API Explorer to generate one for you automatically, and then just replace the "token" variable above with it.
Before running the script, you will also need to have installed the "requests" library. E.g.,
- pip install requests
Enjoy!
Artigos semelhantes
- How to export selective data from HDFS/Hive to MySQL/DB2 using Sqoop
- How does the OLA app enable GPS automatically without going to the device's setting page and retrieve its location so fast for an Android application?
- O history.com é credível?
- How to check my sibling's incognito history on a school Chromebook