igpapi — Instagram private API Simulator for Node.js (API reference) 4.14.0
    Preparing search index...

    Function AndroidApp

    • The Instagram Android app on a virtual device, as a Layer: everything the package's public effects and screens run on — the login, the screens and their actions, the shared mobile effects, ExportSnapshot and ProtocolDiagnostics. The process entries AndroidIgpapi.install, launch and the resume… build this same layer from the same options and run one program on it.

      Start from seed (a deterministic new device) or from snapshot (a session exported earlier with ExportSnapshot, as an object). The other options are those of the native transport and the device's network. A checkpoint is not an option here: the checkpoint is the whole process, so AndroidIgpapi.resumeSilently({ checkpoint, … }) and its siblings continue it on its own screen, building the process themselves.

      One build is one app process. Building the layer creates the device and session state, the native transport client and the process state (screen stack, navigation, telemetry); everything the program changes lives in that build. Provide the layer once around the whole program, or keep it in a ManagedRuntime you own: providing it to two programs separately starts two processes from the same input. Export the snapshot inside the program (or the runtime) whose state it should carry.

      A snapshot that cannot be restored (a damaged cookie jar or state) fails the build with SnapshotDecodeError, an expected failure to handle — usually by logging in again. A snapshot key present but undefined is not a snapshot: it is the caller's "no saved session", so the layer starts a fresh install instead of failing. Invalid options (a request timeout out of range, a protocol mode the Android profile does not have) are a programming error and fail the build as a defect.

      Parameters

      • options:
            | { checkpoint?: undefined; seed: string; snapshot?: undefined } & {
                dangerAcceptInvalidCerts?: boolean;
                location?: MobileDeviceLocation;
                network?: MobileNetwork;
                protocolMode?: TransportProtocolMode;
                proxy?: string;
                requestTimeoutMs?: number;
            }
            | {
                checkpoint?: undefined;
                seed?: undefined;
                snapshot: object
                | MobileSnapshot;
            } & {
                dangerAcceptInvalidCerts?: boolean;
                location?: MobileDeviceLocation;
                network?: MobileNetwork;
                protocolMode?: TransportProtocolMode;
                proxy?: string;
                requestTimeoutMs?: number;
            }
        • { checkpoint?: undefined; seed: string; snapshot?: undefined } & {
              dangerAcceptInvalidCerts?: boolean;
              location?: MobileDeviceLocation;
              network?: MobileNetwork;
              protocolMode?: TransportProtocolMode;
              proxy?: string;
              requestTimeoutMs?: number;
          }
          • Optional Readonlycheckpoint?: undefined
          • Readonlyseed: string
          • Optional Readonlysnapshot?: undefined
          • OptionaldangerAcceptInvalidCerts?: boolean

            Allow invalid TLS certificates in the native transport.

            This is useful for local debugging setups, but should stay disabled for normal production traffic.

          • Optionallocation?: MobileDeviceLocation

            The coarse position the device knows, when the caller models one. The 450 app sends it on the search results, the 451 app sends none on a device without one; when set it replaces a restored snapshot's position.

          • Optionalnetwork?: MobileNetwork

            The network the device is on (default: cellular LTE for a new device; a restored snapshot keeps the network it was saved with). Pass { kind: 'wifi' } to present the device on Wi-Fi; when set it also replaces a restored snapshot's network.

          • OptionalprotocolMode?: TransportProtocolMode

            Protocol mode of the native transport (default http2: Android goes over TCP by the owner's decision). http3 is the caller's opt-in to the app's QUIC path (supported by the transport since 0.9.21); auto is http2 on this profile.

          • Optionalproxy?: string

            HTTP(S) proxy URL passed to the native transport.

          • OptionalrequestTimeoutMs?: number

            Timeout of every API request in milliseconds (default 60 000). A timed-out request is abandoned, not cancelled: an action may still be carried out by the server, so a retry can duplicate it.

        • { checkpoint?: undefined; seed?: undefined; snapshot: object | MobileSnapshot } & {
              dangerAcceptInvalidCerts?: boolean;
              location?: MobileDeviceLocation;
              network?: MobileNetwork;
              protocolMode?: TransportProtocolMode;
              proxy?: string;
              requestTimeoutMs?: number;
          }
          • Optional Readonlycheckpoint?: undefined
          • Optional Readonlyseed?: undefined
          • Readonlysnapshot: object | MobileSnapshot
          • OptionaldangerAcceptInvalidCerts?: boolean

            Allow invalid TLS certificates in the native transport.

            This is useful for local debugging setups, but should stay disabled for normal production traffic.

          • Optionallocation?: MobileDeviceLocation

            The coarse position the device knows, when the caller models one. The 450 app sends it on the search results, the 451 app sends none on a device without one; when set it replaces a restored snapshot's position.

          • Optionalnetwork?: MobileNetwork

            The network the device is on (default: cellular LTE for a new device; a restored snapshot keeps the network it was saved with). Pass { kind: 'wifi' } to present the device on Wi-Fi; when set it also replaces a restored snapshot's network.

          • OptionalprotocolMode?: TransportProtocolMode

            Protocol mode of the native transport (default http2: Android goes over TCP by the owner's decision). http3 is the caller's opt-in to the app's QUIC path (supported by the transport since 0.9.21); auto is http2 on this profile.

          • Optionalproxy?: string

            HTTP(S) proxy URL passed to the native transport.

          • OptionalrequestTimeoutMs?: number

            Timeout of every API request in milliseconds (default 60 000). A timed-out request is abandoned, not cancelled: an action may still be carried out by the server, so a retry can duplicate it.

      Returns Layer<AndroidRuntimeServices, SnapshotDecodeError>

      import { AndroidApp, ExportSnapshot } from '@igpapi/android';
      import { Effect } from 'effect';

      // A program composed by hand runs over the layer: one build is one process.
      const snapshot = await Effect.runPromise(Effect.provide(ExportSnapshot, AndroidApp({ seed: username })));