List and remove browser extensions

I need to write an automated tool to scan through installed browser extensions in the “big three” browsers (Safari, Chrome and Firefox) and remove any that have certain names.

I think I’ve figured this out in Safari, using the script here as an example:

However, that’s a bit clunkier than I would have hoped, and I’m not sure how to do this in Chrome and Firefox. Anybody got any ideas? Is there a way to script the apps to give me this information that I’m not understanding? Or is this going to come down to directly accessing and manipulating these browsers’ support files, as is done with the script at that link?

Thanks in advance!