Extracting your data from Untappd
I rate every pint I taste using the Untappd app. Think of it like TripAdvisor for lager, stout, cider, bitter, and all manner of other beery goodness. Seriously, I've reviewed over 600 different drinks
Recently, I decided to see if I could self-host my beer check-ins. The first step - extracting my own data from Untappd.
Pay To Play
If you become an Untappd Supporter for US$5 per month, you can extract your data in CSV or JSON. I feel like I ought to be able to GDPR that and get it for free but, hey, a couple of quid doesn't seem like a bad way to support an app.
Here's a brief extract:
beer_name,brewery_name,beer_type,beer_abv,beer_ibu,comment,venue_name,venue_city,venue_state,venue_country,venue_lat,venue_lng,rating_score,created_at,checkin_url,beer_url,brewery_url,brewery_country,brewery_city,brewery_state,flavor_profiles,purchase_venue,serving_type,checkin_id,bid,brewery_id,photo_url
"Devon Mist (Cloudy Sparkling Cider)","Sandford Orchards","Cider - Other",4.5,0,"Inoffensive. Found in Aldi.",,,,,,,2.5,"2018-09-29 18:14:59",https://untappd.com/c/657661791,https://untappd.com/beer/163090,https://untappd.com/brewery/14080,England,Crediton,Devon,,,Bottle,657661791,163090,14080,https://untappd.s3.amazonaws.com/photo/2018_09_29/46269e6ba9db8ebc6c66efeddc28edd9_c_657661791_raw.jpeg
"Älska Passion Fruit Apple Cider","Swedish Cider Company ","Cider - Other Fruit",4,0,"Basically an alcopop. Bit sticky.",,,,,,,2,"2018-10-01 19:33:33",https://untappd.com/c/658763031,https://untappd.com/beer/2023147,https://untappd.com/brewery/107942,Sweden,Karlstad,,,,Bottle,658763031,2023147,107942,https://untappd.s3.amazonaws.com/photo/2018_10_01/1a193187913f2429c325c44fe3537b35_c_658763031_raw.jpeg
"War Horse","White Horse Brewery","Extra Special / Strong Bitter",4.9,0,"Gorgeous and light. Summery delicious.","Oxford Playhouse",Oxford,Oxfordshire,"United Kingdom",51.755,-1.26088,4,"2018-10-05 16:51:58",https://untappd.com/c/659797322,https://untappd.com/beer/240251,https://untappd.com/brewery/2678,England,Stanford-in-the-Vale,Oxfordshire,,,,659797322,240251,2678,
Fun fact, the data export didn't originally give a photo URL. So I asked nicely and now it is included for everyone!
But that's not all the data they hold about the check-in.
API
Untappd has a brilliant API which returns much more detail than the CSV export. And you don't even have to pay to use it.
Take a look at this check-in:
JSON
"checkin_id": 658763031,
"created_at": "Mon, 01 Oct 2018 18:33:33 +0000",
"checkin_comment": "Basically an alcopop. Bit sticky.",
"rating_score": 2,
"user": {
"uid": 46296,
"user_name": "edent",
"first_name": "Terence",
"last_name": "E.",
"location": "UK",
"is_supporter": 1,
"url": "https:\/\/shkspr.mobi\/blog",
"bio": "Long haired geek.",
"relationship": null,
"user_avatar": "https:\/\/untappd.akamaized.net\/profile\/5d928465e29fec4375a2990ca2767852_thumb.jpg",
"is_private": 0,
"contact": {
"twitter": "edent",
"foursquare": "56367",
"facebook": "609836217"
}
},
"beer": {
"bid": 2023147,
"beer_name": "Älska Passion Fruit Apple Cider",
"beer_label": "https:\/\/untappd.akamaized.net\/site\/assets\/images\/temp\/badge-beer-default.png",
"beer_style": "Cider - Other Fruit",
"beer_slug": "swedish-cider-company-alska-passion-fruit-apple-cider",
"beer_abv": 4,
"beer_active": 1,
"has_had": false
},
"brewery": {
"brewery_id": 107942,
"brewery_name": "Swedish Cider Company ",
"brewery_slug": "swedish-cider-company",
"brewery_page_url": "\/w\/swedish-cider-company\/107942",
"brewery_type": "Cidery",
"brewery_label": "https:\/\/untappd.akamaized.net\/site\/brewery_logos\/brewery-107942_ca21d.jpeg",
"country_name": "Sweden",
"contact": {
"twitter": "",
"facebook": "",
"instagram": "",
"url": "http:\/\/www.alskacider.com"
},
"location": {
"brewery_city": "Karlstad",
"brewery_state": "",
"lat": 59.4109,
"lng": 13.4854
},
"brewery_active": 1
},
"venue": [],
"comments": {
"total_count": 0,
"count": 0,
"items": []
},
"toasts": {
"total_count": 0,
"count": 0,
"auth_toast": false,
"items": []
},
"media": {
"count": 1,
"items": [{
"photo_id": 195061947,
"photo": {
"photo_img_sm": "https:\/\/untappd.akamaized.net\/photo\/2018_10_01\/1a193187913f2429c325c44fe3537b35_c_658763031_200x200.jpeg",
"photo_img_md": "https:\/\/untappd.akamaized.net\/photo\/2018_10_01\/1a193187913f2429c325c44fe3537b35_c_658763031_640x640.jpeg",
"photo_img_lg": "https:\/\/untappd.akamaized.net\/photo\/2018_10_01\/1a193187913f2429c325c44fe3537b35_c_658763031_1280x1280.jpeg",
"photo_img_og": "https:\/\/untappd.akamaized.net\/photo\/2018_10_01\/1a193187913f2429c325c44fe3537b35_c_658763031_raw.jpeg"
}
}]
},
"source": {
"app_name": "Untappd for iPhone - (V2)",
"app_website": "http:\/\/untpd.it\/iphoneapp"
},
"badges": {
"retro_status": false,
"count": 1,
"items": [{
"badge_id": 2980,
"user_badge_id": 401989193,
"badge_name": "Johnny Appleseed (Level 34)",
"badge_description": "Grab a pot and put it on your head because you're a modern day Johnny Appleseed. That's 170 different ciders. Try 5 more to unlock Level 35.",
"created_at": "Mon, 01 Oct 2018 18:33:33 +0000",
"badge_image": {
"sm": "https:\/\/untappd.akamaized.net\/badges\/bdg_appleseed_sm.jpg",
"md": "https:\/\/untappd.akamaized.net\/badges\/bdg_appleseed_md.jpg",
"lg": "https:\/\/untappd.akamaized.net\/badges\/bdg_appleseed_lg.jpg"
}
}]
}
Badges! Beer labels! Locations! Venues! Images! Data!
By default, the API only returns 25 check-ins per request. But it does come with a pagination option:
JSON
"pagination": {
"since_url": "https:\/\/api.untappd.com\/v4\/user\/checkins\/edent?min_id=659797322",
"next_url": "https:\/\/api.untappd.com\/v4\/user\/checkins\/edent?max_id=602463014",
"max_id": 602463014
},
Python Power!
Here's a quick script which will download all your beer-data and create a single JSON file to use. You will need to register an API key and generate your own access token.
Python 3
import json
import requests
username = "abc"
client_id = "123"
client_secret= "456"
access_token = "789"
user = requests.get("https://api.untappd.com/v4/user/info/"+username+"?client_id="+client_id+"&client_secret="+client_secret)
user_data = user.json()
total_checkins = user_data["response"]["user"]["stats"]["total_checkins"]
print("Total Checkins = " + str(total_checkins))
checkins = requests.get("https://api.untappd.com/v4/user/checkins/?access_token="+access_token)
checkins_data = checkins.json()
full_data = checkins_data["response"]["checkins"]["items"]
while (len(full_data) < total_checkins):
max_id = checkins_data["response"]["pagination"]["max_id"]
next_url = "https://api.untappd.com/v4/user/checkins/?max_id=" + str(max_id) + "&access_token="+access_token
print("Downloading " + next_url)
checkins = requests.get(next_url)
checkins_data = checkins.json()
full_data.extend(checkins_data["response"]["checkins"]["items"])
with open("untappd_data.json", "w") as f:
json.dump(full_data, f)
That will save a file with all your data. Happy drinking!
@edent says:
beer.py
python3 beer.py
to get it to run.Rick Engle says:
Mike says:
BCarney says:
"Thank you for your interest in the Untappd API. Due to API abuse, we are no longer making API access available without a commercial agreement. This policy ensures the continued quality and integrity of our services."
Any alternative to access the data I gave Untappd?
@edent says:
You've got a few choices.
If you log in and go to user settings, there's an option to get a private RSS feed. That has the names of the beers, your comments, and your photos. No ratings though.
It's possible to screenscrape the website.
You could try sending them a GDPR request for your data.
Finally, as I say in the post, you can pay to be an Untappd Insider - https://insiders.untappd.com/ - that will allow you to do an export of your data.