Cleaning out Google Groups

Google Groups are one of the products that has languished in 2014 in terms of its feature set and visual design. This means that many useful abilities like mass-deleting topics and exporting Google Groups aren't implemented. For exportation, some people have come up with clever workarounds by crawling the website. In the past I've used gggd, a fantastic Python command-line script to download full groups that I highly recommend. However, I couldn't find anything to mass delete I made one.

Unfortunately, the functionality to select multiple topics (what GG calls message threads) and delete them all is relatively broken. Trying to do chunks will result in server errors, and the deletes failing to go through. The only foolproof way to delete a topic is to open up the topic, choose "Action" from there, then click "Delete", then choose the deletion reason ("Other") and click submit. No one's going to bother doing that for thousands of topics (or in my case tens of thousands of topics), so automation is the way to go. I spent about one minute looking at the request payload for the deletion before I realized that faking the requests was going to take way too long to figure out:


Instead, I figured "if I can do it, a computer can do it." So I wrote a quick Python script that leverages Selenium to automatically go through this process. You can download it from this gist, and it will delete every topic in a group if for some reason you want to clear it out (in my case because I want to maintain the grandfathered-in status of the group as not having an "unsubscribe" footer). Simply install Selenium for Python using pip install selenium, and download a driver from this link, and you're good to go!