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 topics...so 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:

7|3|15|https://groups.google.com/forum/|4D6FFE1D5FF1C05CFD77CFF28DB78F9E|6q|APQx5HRkM8NUz95B9uusAbUkgmgUYw2q1A:1502086132212|_|deleteTopics|k|5r|5a|<group_name>|6j|6x|o9pvl7XufYU|5c|1q|1|2|3|4|5|6|3|7|8|9|7|10|10|0|0|11|12|13|14|15|3|

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!