as one of contributors to the tutor project, I'd recommend Tutor as way to programmatically query gatherer on the command line in a way that handles a lot of the edge cases. I use it on
http://cuesbey.com to import into my own data model.
https://github.com/davidchambers/tutor
and
npm install tutor