Most of the code here is about making API calls to Connect in order to get data.
In other projects, I've used the connectapi package to download this sort of data. If you think this would be a useful refactor, I can write a PR. Currently I am working on something related (shiny usage data), so maybe we can talk more about the details in other place.