Instagram API: view and backup direct messages from a web browser

Instagram does not have a web version to view messages received from other Instagram users. You have to use their proprietary Android or iOS app but not everybody is using these mobile operating systems (especially people caring about privacy) as well as proprietary apps like Instagram, which may contain spyware.
It can also be more convenient to access direct messages while we are logged in on a desktop computer on Instagram web version, instead of having to use a smartphone just to check messages. Being forced to use an app on a specific platform is not good for accessibility.

Instagram provides a way to backup data through their website by receiving a link to an archive by email but you have to wait some time and cannot easily filter the data you want.
Here is a script using Instagram private API that can be used in a web browser to view and backup direct messages in real time.

See also: Instagram API: send direct messages from a web browsers

Download script from my server: instagram-api_direct_messages_backup.js
On Pastebin
On GitHub