Wedding Planning Meets Hacking
As of today, my fiancée and I are just under 100 days from our upcoming wedding. And while we haven’t run into many wedding planning snafus, it’s been easy to find technological annoyances, especially when dealing with different companies or technologies for different aspects of the wedding: save-the-dates, website, registries, invitations, RSVPs, and more. (Yes, I know The Knot has all that functionality, but sometimes one feature works or looks better on one site and another is better on another site.)
The other day we were working on gathering the addresses of all our invitees. We had used Minted for our Save the Dates (but wanted to use Elli for our actual invitations; the design better matches our website). I went to the helpful-sounding “Address Assistant” feature to pull the existing contacts from our address book in Minted, but it didn’t seem possible.
Option #1: A little scraping
Okay, so Minted (as shown above) allows you to print your contact list and in doing so displays all the contacts in a new print-friendly, formatted, separate window. I decided to scrape that page using Beautiful Soup along with Selenium to help deal with the fact that I needed to login with my Minted credentials to gain access to my address book contents.
Inspecting the print contacts page, you notice that it’s pretty sparsely laid out as one giant unordered list without any organization of the different address fields. Rather the street address and town/state/zip code are text blocks under the same class name “contact-address” separated only by a <br> tag.
A little data cleaning with regular expressions, I was quickly able to programmatically output my list of addresses to an excel file. It wasn’t ideal — the regex works for US formatted addresses, but it got the job done. But could there be a better way?
Option #2: Is that an API I see there?
Searching Twitter, it was clear that I wasn’t the only one upset about Minted not having an export feature….
But as @z3dster points out, there’s a little more than meets the eye at first glance…
Clearly Minted is using their API to power the address book features. They have all your address book fields neatly organized in a JSON format, but never got around to building an address export feature. (I guess that’s one way to try to prop up customer stickiness…?)
This revelation led me to simplify the script significantly by using Selenium-Requests. Tapping into the existing API you can receive all the address book fields (address1, address2, locality, administrative_area, postal_code, country) automatically neatly organized regardless of the locale. Within 10 seconds, your full Minted address book is exported to an excel spreadsheet!
Check out the code on my GitHub repo and please reach out if you need any assistance!
Hope it helps a few happy couples navigate their wedding planning process as well — if you really love it feel free to contribute to our Newlywed Fund!