RomainVialard / Google-Plus-Community-Migrator

https://docs.google.com/document/d/1UGhxaN5AiRXXL0Ki0DlVWLYJo_YYiEYhM2w1caRhljU/edit
12 stars 5 forks source link

pagination for all endpoints using batch operations #13

Closed brainysmurf closed 5 years ago

brainysmurf commented 5 years ago

Perhaps put this on a different branch and test before merging to master. No additional setup required, all that is needed is that the Plus endpoints enabled in the google console for the project. Note that this code does not technically need the Plus variable defined in Advanced Google Services, but it won't conflict if it is.

After 2 executions:

But then I hit the daily quota limit.

brainysmurf commented 5 years ago

By manually migrating the script properties (by making copy of the script and manually updating the new script's properties), I have downloaded 10,000 posts in 1/2 hour.

brainysmurf commented 5 years ago

Whoops. I believe for example the comments endpoint, I need to put the maxResults property inside an object and pass that to query property.

Will get to it when in front of a desktop.

brainysmurf commented 5 years ago

Yeah, I was right; fixed now. Those endpoints have 100 as the max for maxResults.

That is after one run, hit quota on second run, after which:

brainysmurf commented 5 years ago

Update: I've confirmed I'm hitting the 10K daily limit on a single execution. Coding it up now so that we approach but don't exceed, then ends. Suggest creating trigger to execute 24 hours later.

EDIT: Just realized: The pageToken will probably be invalid 24 hours later! Hmmmm....

RomainVialard commented 5 years ago

@brainysmurf I've done several exports over multiple days without issues regarding the validity of the pageToken, you shouldn't have issues with that.

brainysmurf commented 5 years ago

Oh okay. But it made me think hard about not depending on the pageToken between executions. I realize that we can probably get the user to export out everything in one sitting with the following:

RomainVialard commented 5 years ago

How would you "pick up posts that haven’t already been saved in fb" without the nextPageToken?

brainysmurf commented 5 years ago

Testing shows that the fast forward approach is just too slow; I’ll put nextPageToken in fb instead. By avoiding the use of script properties, user can just make copy of project to finish off the downloading.

brainysmurf commented 5 years ago

I've refactored Code.gs entirely with improvements from this branch; closing in preference for refactor branch.