@den Earlier today I wrote a Python script that is similar to what you described.
I have a file toots.json that contains all my toots and then a script refreshtoots.py that queries the JSON API and update toots.json to contain the old and new toots.
You're welcome to check it out and adapt/use it if it fits your needs.
https://github.com/Brandon-Rozek/website/blob/master/refreshtoots.py
@brozek Awesome. Thanks. I think I’ll need to do it in Node but the principle is basically the same.