Skip to content
This repository was archived by the owner on Jan 31, 2021. It is now read-only.
This repository was archived by the owner on Jan 31, 2021. It is now read-only.

Resume/retry capabilities #48

Description

@maliayas

Youtube API sometimes may return error pages (such as #47) or simply a network error may break the whole fetching process.

To overcome this, I'll kindly propose the below approach:

  1. Turn the scheme into something like this:

    {
        "comments": [
            // ...
        ],
        "numberOfTotalComments": 2300,
        "nextPageToken": null
    }
  2. If an error is encountered at some point, save the partial data to the file with "nextPageToken" being set.

  3. If the user runs the same command again, check if the "nextPageToken" is not empty, and if so resume the operation using it.

And some notes about this approach:

  • "nextPageToken": null means everything is successfully downloaded.
  • On step 2 above, when there is an error, the script can actually make a second try before failing and saving partial data.
  • To decrease the chance of error, there may be delay between requests (in fact I looked at the source code to see if this is already done but failed; because JS code, to me, is very hard to follow)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions