nodejs-insta-private-api-mqt 1.3.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +3677 -0
- package/dist/constants/constants.js +342 -0
- package/dist/constants/index.js +58 -0
- package/dist/core/client.js +419 -0
- package/dist/core/nav-chain.js +282 -0
- package/dist/core/repository.js +7 -0
- package/dist/core/request.js +390 -0
- package/dist/core/state.js +1473 -0
- package/dist/core/utils.js +786 -0
- package/dist/downloadMedia.js +381 -0
- package/dist/errors/index.d.ts +16 -0
- package/dist/errors/index.js +38 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/extend.js +167 -0
- package/dist/fbns/fbns.client.d.ts +32 -0
- package/dist/fbns/fbns.client.events.d.ts +41 -0
- package/dist/fbns/fbns.client.events.js +3 -0
- package/dist/fbns/fbns.client.events.js.map +1 -0
- package/dist/fbns/fbns.client.js +252 -0
- package/dist/fbns/fbns.client.js.map +1 -0
- package/dist/fbns/fbns.device-auth.d.ts +17 -0
- package/dist/fbns/fbns.device-auth.js +54 -0
- package/dist/fbns/fbns.device-auth.js.map +1 -0
- package/dist/fbns/fbns.types.d.ts +83 -0
- package/dist/fbns/fbns.types.js +3 -0
- package/dist/fbns/fbns.types.js.map +1 -0
- package/dist/fbns/fbns.utilities.d.ts +2 -0
- package/dist/fbns/fbns.utilities.js +79 -0
- package/dist/fbns/fbns.utilities.js.map +1 -0
- package/dist/fbns/index.d.ts +4 -0
- package/dist/fbns/index.js +21 -0
- package/dist/fbns/index.js.map +1 -0
- package/dist/index.js +139 -0
- package/dist/mqtt-shim.d.ts +96 -0
- package/dist/mqtt-shim.js +15 -0
- package/dist/mqttot/index.d.ts +4 -0
- package/dist/mqttot/index.js +21 -0
- package/dist/mqttot/index.js.map +1 -0
- package/dist/mqttot/mqttot.client.d.ts +39 -0
- package/dist/mqttot/mqttot.client.js +318 -0
- package/dist/mqttot/mqttot.client.js.map +1 -0
- package/dist/mqttot/mqttot.connect.request.packet.d.ts +7 -0
- package/dist/mqttot/mqttot.connect.request.packet.js +9 -0
- package/dist/mqttot/mqttot.connect.request.packet.js.map +1 -0
- package/dist/mqttot/mqttot.connect.response.packet.d.ts +7 -0
- package/dist/mqttot/mqttot.connect.response.packet.js +24 -0
- package/dist/mqttot/mqttot.connect.response.packet.js.map +1 -0
- package/dist/mqttot/mqttot.connection.d.ts +57 -0
- package/dist/mqttot/mqttot.connection.js +79 -0
- package/dist/mqttot/mqttot.connection.js.map +1 -0
- package/dist/package.json +59 -0
- package/dist/realtime/commands/commands.d.ts +15 -0
- package/dist/realtime/commands/commands.js +71 -0
- package/dist/realtime/commands/commands.js.map +1 -0
- package/dist/realtime/commands/direct.commands.d.ts +75 -0
- package/dist/realtime/commands/direct.commands.js +417 -0
- package/dist/realtime/commands/direct.commands.js.map +1 -0
- package/dist/realtime/commands/enhanced.direct.commands.js +1731 -0
- package/dist/realtime/commands/enhanced.direct.commands.js.bak +967 -0
- package/dist/realtime/commands/index.d.ts +2 -0
- package/dist/realtime/commands/index.js +20 -0
- package/dist/realtime/commands/index.js.map +1 -0
- package/dist/realtime/delta-sync.manager.js +293 -0
- package/dist/realtime/features/dm-sender.js +88 -0
- package/dist/realtime/features/error-handler.js +185 -0
- package/dist/realtime/features/gap-handler.js +61 -0
- package/dist/realtime/features/persistent-logger.js +186 -0
- package/dist/realtime/features/presence.manager.js +66 -0
- package/dist/realtime/features/session-health-monitor.js +345 -0
- package/dist/realtime/index.js +30 -0
- package/dist/realtime/messages/app-presence.event.d.ts +9 -0
- package/dist/realtime/messages/app-presence.event.js +3 -0
- package/dist/realtime/messages/app-presence.event.js.map +1 -0
- package/dist/realtime/messages/index.d.ts +3 -0
- package/dist/realtime/messages/index.js +20 -0
- package/dist/realtime/messages/index.js.map +1 -0
- package/dist/realtime/messages/message-sync.message.d.ts +222 -0
- package/dist/realtime/messages/message-sync.message.js +43 -0
- package/dist/realtime/messages/message-sync.message.js.map +1 -0
- package/dist/realtime/messages/realtime-sub.direct.data.d.ts +11 -0
- package/dist/realtime/messages/realtime-sub.direct.data.js +3 -0
- package/dist/realtime/messages/realtime-sub.direct.data.js.map +1 -0
- package/dist/realtime/messages/thread-update.message.d.ts +68 -0
- package/dist/realtime/messages/thread-update.message.js +3 -0
- package/dist/realtime/messages/thread-update.message.js.map +1 -0
- package/dist/realtime/mixins/index.d.ts +3 -0
- package/dist/realtime/mixins/index.js +20 -0
- package/dist/realtime/mixins/index.js.map +1 -0
- package/dist/realtime/mixins/message-sync.mixin.d.ts +8 -0
- package/dist/realtime/mixins/message-sync.mixin.js +596 -0
- package/dist/realtime/mixins/message-sync.mixin.js.map +1 -0
- package/dist/realtime/mixins/mixin.d.ts +19 -0
- package/dist/realtime/mixins/mixin.js +41 -0
- package/dist/realtime/mixins/mixin.js.map +1 -0
- package/dist/realtime/mixins/presence-typing.mixin.js +33 -0
- package/dist/realtime/mixins/realtime-sub.mixin.d.ts +8 -0
- package/dist/realtime/mixins/realtime-sub.mixin.js +181 -0
- package/dist/realtime/mixins/realtime-sub.mixin.js.map +1 -0
- package/dist/realtime/parsers/graphql-parser.js +43 -0
- package/dist/realtime/parsers/graphql.parser.d.ts +15 -0
- package/dist/realtime/parsers/graphql.parser.js +22 -0
- package/dist/realtime/parsers/graphql.parser.js.map +1 -0
- package/dist/realtime/parsers/index.d.ts +6 -0
- package/dist/realtime/parsers/index.js +23 -0
- package/dist/realtime/parsers/index.js.map +1 -0
- package/dist/realtime/parsers/iris-parser.js +43 -0
- package/dist/realtime/parsers/iris.parser.d.ts +17 -0
- package/dist/realtime/parsers/iris.parser.js +10 -0
- package/dist/realtime/parsers/iris.parser.js.map +1 -0
- package/dist/realtime/parsers/json-parser.js +43 -0
- package/dist/realtime/parsers/json.parser.d.ts +6 -0
- package/dist/realtime/parsers/json.parser.js +10 -0
- package/dist/realtime/parsers/json.parser.js.map +1 -0
- package/dist/realtime/parsers/parser.d.ts +9 -0
- package/dist/realtime/parsers/parser.js +3 -0
- package/dist/realtime/parsers/parser.js.map +1 -0
- package/dist/realtime/parsers/region-hint-parser.js +43 -0
- package/dist/realtime/parsers/region-hint.parser.d.ts +12 -0
- package/dist/realtime/parsers/region-hint.parser.js +15 -0
- package/dist/realtime/parsers/region-hint.parser.js.map +1 -0
- package/dist/realtime/parsers/skywalker-parser.js +43 -0
- package/dist/realtime/parsers/skywalker.parser.d.ts +12 -0
- package/dist/realtime/parsers/skywalker.parser.js +15 -0
- package/dist/realtime/parsers/skywalker.parser.js.map +1 -0
- package/dist/realtime/parsers-advanced.js +158 -0
- package/dist/realtime/proto/common.proto +38 -0
- package/dist/realtime/proto/direct.proto +65 -0
- package/dist/realtime/proto/ig-messages.proto +83 -0
- package/dist/realtime/proto/iris.proto +188 -0
- package/dist/realtime/proto-parser.js +195 -0
- package/dist/realtime/protocols/iris.handshake.js +74 -0
- package/dist/realtime/protocols/proto-definitions.js +80 -0
- package/dist/realtime/protocols/skywalker.protocol.js +91 -0
- package/dist/realtime/realtime.client.events.js +3 -0
- package/dist/realtime/realtime.client.js +1915 -0
- package/dist/realtime/realtime.service.js +462 -0
- package/dist/realtime/reconnect.manager.js +88 -0
- package/dist/realtime/session.manager.js +121 -0
- package/dist/realtime/subscriptions/graphql.subscription.d.ts +47 -0
- package/dist/realtime/subscriptions/graphql.subscription.js +99 -0
- package/dist/realtime/subscriptions/graphql.subscription.js.map +1 -0
- package/dist/realtime/subscriptions/index.d.ts +2 -0
- package/dist/realtime/subscriptions/index.js +19 -0
- package/dist/realtime/subscriptions/index.js.map +1 -0
- package/dist/realtime/subscriptions/skywalker.subscription.d.ts +4 -0
- package/dist/realtime/subscriptions/skywalker.subscription.js +13 -0
- package/dist/realtime/subscriptions/skywalker.subscription.js.map +1 -0
- package/dist/realtime/topic-map.js +71 -0
- package/dist/realtime/topic.js +80 -0
- package/dist/repositories/account.repository.js +575 -0
- package/dist/repositories/bloks.repository.js +70 -0
- package/dist/repositories/captcha.repository.js +44 -0
- package/dist/repositories/challenge.repository.js +120 -0
- package/dist/repositories/clip.repository.js +165 -0
- package/dist/repositories/close-friends.repository.js +46 -0
- package/dist/repositories/collection.repository.js +68 -0
- package/dist/repositories/direct-thread.repository.js +446 -0
- package/dist/repositories/direct.repository.js +232 -0
- package/dist/repositories/explore.repository.js +70 -0
- package/dist/repositories/fbsearch.repository.js +140 -0
- package/dist/repositories/feed.repository.js +245 -0
- package/dist/repositories/friendship.repository.js +296 -0
- package/dist/repositories/fundraiser.repository.js +49 -0
- package/dist/repositories/hashtag.repository.js +99 -0
- package/dist/repositories/highlights.repository.js +121 -0
- package/dist/repositories/insights.repository.js +82 -0
- package/dist/repositories/location.repository.js +84 -0
- package/dist/repositories/media.repository.js +395 -0
- package/dist/repositories/multiple-accounts.repository.js +41 -0
- package/dist/repositories/news.repository.js +35 -0
- package/dist/repositories/note.repository.js +57 -0
- package/dist/repositories/notification.repository.js +79 -0
- package/dist/repositories/share.repository.js +35 -0
- package/dist/repositories/signup.repository.js +218 -0
- package/dist/repositories/story.repository.js +290 -0
- package/dist/repositories/timeline.repository.js +60 -0
- package/dist/repositories/totp.repository.js +139 -0
- package/dist/repositories/track.repository.js +53 -0
- package/dist/repositories/upload.repository.js +204 -0
- package/dist/repositories/user.repository.js +360 -0
- package/dist/sendmedia/index.js +27 -0
- package/dist/sendmedia/sendFile.js +72 -0
- package/dist/sendmedia/sendPhoto.js +142 -0
- package/dist/sendmedia/sendRavenPhoto.js +153 -0
- package/dist/sendmedia/sendRavenVideo.js +158 -0
- package/dist/sendmedia/uploadPhoto.js +107 -0
- package/dist/sendmedia/uploadfFile.js +130 -0
- package/dist/services/live.service.js +139 -0
- package/dist/services/search.service.js +115 -0
- package/dist/shared/index.js +96 -0
- package/dist/shared/shared.js +86 -0
- package/dist/thrift/index.d.ts +3 -0
- package/dist/thrift/index.js +20 -0
- package/dist/thrift/index.js.map +1 -0
- package/dist/thrift/thrift.d.ts +59 -0
- package/dist/thrift/thrift.js +101 -0
- package/dist/thrift/thrift.js.map +1 -0
- package/dist/thrift/thrift.reading.d.ts +41 -0
- package/dist/thrift/thrift.reading.js +327 -0
- package/dist/thrift/thrift.reading.js.map +1 -0
- package/dist/thrift/thrift.writing.d.ts +44 -0
- package/dist/thrift/thrift.writing.js +342 -0
- package/dist/thrift/thrift.writing.js.map +1 -0
- package/dist/types/index.js +285 -0
- package/dist/useMultiFileAuthState.js +1768 -0
- package/dist/utils/helper-1.js +1 -0
- package/dist/utils/helper-10.js +1 -0
- package/dist/utils/helper-11.js +1 -0
- package/dist/utils/helper-12.js +1 -0
- package/dist/utils/helper-13.js +1 -0
- package/dist/utils/helper-14.js +1 -0
- package/dist/utils/helper-15.js +1 -0
- package/dist/utils/helper-16.js +1 -0
- package/dist/utils/helper-17.js +1 -0
- package/dist/utils/helper-18.js +1 -0
- package/dist/utils/helper-19.js +1 -0
- package/dist/utils/helper-2.js +1 -0
- package/dist/utils/helper-20.js +1 -0
- package/dist/utils/helper-21.js +1 -0
- package/dist/utils/helper-22.js +1 -0
- package/dist/utils/helper-23.js +1 -0
- package/dist/utils/helper-24.js +1 -0
- package/dist/utils/helper-25.js +1 -0
- package/dist/utils/helper-26.js +1 -0
- package/dist/utils/helper-27.js +1 -0
- package/dist/utils/helper-28.js +1 -0
- package/dist/utils/helper-29.js +1 -0
- package/dist/utils/helper-3.js +1 -0
- package/dist/utils/helper-30.js +1 -0
- package/dist/utils/helper-4.js +1 -0
- package/dist/utils/helper-5.js +1 -0
- package/dist/utils/helper-6.js +1 -0
- package/dist/utils/helper-7.js +1 -0
- package/dist/utils/helper-8.js +1 -0
- package/dist/utils/helper-9.js +1 -0
- package/dist/utils/index.js +280 -0
- package/dist/utils/insta-mqtt-helper.js +128 -0
- package/examples/listen-to-messages.js +86 -0
- package/package.json +82 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readConnectResponsePacket = exports.MQTToTConnectResponsePacket = void 0;
|
|
4
|
+
const mqtts_1 = require("mqtts");
|
|
5
|
+
class MQTToTConnectResponsePacket extends mqtts_1.ConnectResponsePacket {
|
|
6
|
+
constructor(ackFlags, returnCode, payload) {
|
|
7
|
+
super(ackFlags, returnCode);
|
|
8
|
+
this.payload = payload;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.MQTToTConnectResponsePacket = MQTToTConnectResponsePacket;
|
|
12
|
+
function readConnectResponsePacket(stream, remaining) {
|
|
13
|
+
const ack = stream.readByte();
|
|
14
|
+
const returnCode = stream.readByte();
|
|
15
|
+
if (ack > 1) {
|
|
16
|
+
throw new Error('Invalid ack');
|
|
17
|
+
}
|
|
18
|
+
else if (returnCode > 5) {
|
|
19
|
+
throw new Error('Invalid return code');
|
|
20
|
+
}
|
|
21
|
+
return new MQTToTConnectResponsePacket(ack, returnCode, remaining > 2 ? stream.readStringAsBuffer() : Buffer.alloc(0));
|
|
22
|
+
}
|
|
23
|
+
exports.readConnectResponsePacket = readConnectResponsePacket;
|
|
24
|
+
//# sourceMappingURL=mqttot.connect.response.packet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mqttot.connect.response.packet.js","sourceRoot":"","sources":["../../src/mqttot/mqttot.connect.response.packet.ts"],"names":[],"mappings":";;;AAAA,iCAA+E;AAE/E,MAAa,2BAA4B,SAAQ,6BAAqB;IACnE,YACG,QAAgB,EAChB,UAA6B,EACb,OAAe;QAE/B,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAFZ,YAAO,GAAP,OAAO,CAAQ;IAGlC,CAAC;CACH;AARD,kEAQC;AAED,SAAgB,yBAAyB,CAAC,MAAoB,EAAE,SAAiB;IAC9E,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC9B,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IACrC,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC;SAAM,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,IAAI,2BAA2B,CACnC,GAAG,EACH,UAA+B,EAC/B,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAC/D,CAAC;AACL,CAAC;AAbD,8DAaC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Int64, ThriftPacketDescriptor } from '../thrift';
|
|
3
|
+
export type MQTToTConnectionData = Partial<{
|
|
4
|
+
clientIdentifier: string;
|
|
5
|
+
willTopic: string;
|
|
6
|
+
willMessage: string;
|
|
7
|
+
clientInfo: MQTToTConnectionClientInfo;
|
|
8
|
+
password: string;
|
|
9
|
+
unknown: number;
|
|
10
|
+
appSpecificInfo: MQTToTConnectionAppSpecificInfo;
|
|
11
|
+
}>;
|
|
12
|
+
export type MQTToTConnectionAppSpecificInfo = Partial<{
|
|
13
|
+
app_version: string;
|
|
14
|
+
'X-IG-Capabilities': string;
|
|
15
|
+
everclear_subscriptions: string;
|
|
16
|
+
'User-Agent': string;
|
|
17
|
+
'Accept-Language': string;
|
|
18
|
+
platform: string;
|
|
19
|
+
ig_mqtt_route: string;
|
|
20
|
+
pubsub_msg_type_blacklist: string;
|
|
21
|
+
auth_cache_enabled: string;
|
|
22
|
+
}>;
|
|
23
|
+
export type MQTToTConnectionClientInfo = Partial<{
|
|
24
|
+
userId: Int64;
|
|
25
|
+
userAgent: string;
|
|
26
|
+
clientCapabilities: Int64;
|
|
27
|
+
endpointCapabilities: Int64;
|
|
28
|
+
publishFormat: number;
|
|
29
|
+
noAutomaticForeground: boolean;
|
|
30
|
+
makeUserAvailableInForeground: boolean;
|
|
31
|
+
deviceId: string;
|
|
32
|
+
isInitiallyForeground: boolean;
|
|
33
|
+
networkType: number;
|
|
34
|
+
networkSubtype: number;
|
|
35
|
+
clientMqttSessionId: Int64;
|
|
36
|
+
clientIpAddress: string;
|
|
37
|
+
subscribeTopics: number[];
|
|
38
|
+
clientType: string;
|
|
39
|
+
appId: Int64;
|
|
40
|
+
overrideNectarLogging: boolean;
|
|
41
|
+
connectTokenHash: string;
|
|
42
|
+
regionPreference: string;
|
|
43
|
+
deviceSecret: string;
|
|
44
|
+
clientStack: number;
|
|
45
|
+
fbnsConnectionKey: number;
|
|
46
|
+
fbnsConnectionSecret: string;
|
|
47
|
+
fbnsDeviceId: string;
|
|
48
|
+
fbnsDeviceSecret: string;
|
|
49
|
+
anotherUnknown: Int64;
|
|
50
|
+
}>;
|
|
51
|
+
export declare class MQTToTConnection {
|
|
52
|
+
fbnsConnectionData: MQTToTConnectionData;
|
|
53
|
+
static thriftConfig: ThriftPacketDescriptor[];
|
|
54
|
+
constructor(connectionData: MQTToTConnectionData);
|
|
55
|
+
toThrift(): Buffer;
|
|
56
|
+
toString(): string;
|
|
57
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MQTToTConnection = void 0;
|
|
4
|
+
const thrift_1 = require("../thrift");
|
|
5
|
+
|
|
6
|
+
class MQTToTConnection {
|
|
7
|
+
constructor(connectionData) {
|
|
8
|
+
this.fbnsConnectionData = connectionData;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
toThrift() {
|
|
12
|
+
// Clone safely – DO NOT mutate original objects used by MQTT
|
|
13
|
+
const connCopy = Object.assign({}, this.fbnsConnectionData);
|
|
14
|
+
const originalClientInfo = this.fbnsConnectionData && this.fbnsConnectionData.clientInfo;
|
|
15
|
+
const clientInfoCopy = originalClientInfo ? Object.assign({}, originalClientInfo) : undefined;
|
|
16
|
+
|
|
17
|
+
if (clientInfoCopy) {
|
|
18
|
+
// ✅ MQTT REQUIRES STRING
|
|
19
|
+
if (typeof clientInfoCopy.userAgent !== 'string' || !clientInfoCopy.userAgent) {
|
|
20
|
+
clientInfoCopy.userAgent = 'Instagram 415.0.0.36.76 Android';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// ✅ MQTT REQUIRES STRING
|
|
24
|
+
if (typeof clientInfoCopy.clientType !== 'string' || !clientInfoCopy.clientType) {
|
|
25
|
+
clientInfoCopy.clientType = 'com.instagram.android';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
connCopy.clientInfo = clientInfoCopy;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// ✅ Thrift will serialize binary fields correctly
|
|
32
|
+
return (0, thrift_1.thriftWriteFromObject)(connCopy, MQTToTConnection.thriftConfig);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
toString() {
|
|
36
|
+
return this.toThrift().toString();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exports.MQTToTConnection = MQTToTConnection;
|
|
41
|
+
|
|
42
|
+
MQTToTConnection.thriftConfig = [
|
|
43
|
+
thrift_1.ThriftDescriptors.binary('clientIdentifier', 1),
|
|
44
|
+
thrift_1.ThriftDescriptors.binary('willTopic', 2),
|
|
45
|
+
thrift_1.ThriftDescriptors.binary('willMessage', 3),
|
|
46
|
+
thrift_1.ThriftDescriptors.struct('clientInfo', 4, [
|
|
47
|
+
thrift_1.ThriftDescriptors.int64('userId', 1),
|
|
48
|
+
thrift_1.ThriftDescriptors.binary('userAgent', 2),
|
|
49
|
+
thrift_1.ThriftDescriptors.int64('clientCapabilities', 3),
|
|
50
|
+
thrift_1.ThriftDescriptors.int64('endpointCapabilities', 4),
|
|
51
|
+
thrift_1.ThriftDescriptors.int32('publishFormat', 5),
|
|
52
|
+
thrift_1.ThriftDescriptors.boolean('noAutomaticForeground', 6),
|
|
53
|
+
thrift_1.ThriftDescriptors.boolean('makeUserAvailableInForeground', 7),
|
|
54
|
+
thrift_1.ThriftDescriptors.binary('deviceId', 8),
|
|
55
|
+
thrift_1.ThriftDescriptors.boolean('isInitiallyForeground', 9),
|
|
56
|
+
thrift_1.ThriftDescriptors.int32('networkType', 10),
|
|
57
|
+
thrift_1.ThriftDescriptors.int32('networkSubtype', 11),
|
|
58
|
+
thrift_1.ThriftDescriptors.int64('clientMqttSessionId', 12),
|
|
59
|
+
thrift_1.ThriftDescriptors.binary('clientIpAddress', 13),
|
|
60
|
+
thrift_1.ThriftDescriptors.listOfInt32('subscribeTopics', 14),
|
|
61
|
+
thrift_1.ThriftDescriptors.binary('clientType', 15),
|
|
62
|
+
thrift_1.ThriftDescriptors.int64('appId', 16),
|
|
63
|
+
thrift_1.ThriftDescriptors.boolean('overrideNectarLogging', 17),
|
|
64
|
+
thrift_1.ThriftDescriptors.binary('connectTokenHash', 18),
|
|
65
|
+
thrift_1.ThriftDescriptors.binary('regionPreference', 19),
|
|
66
|
+
thrift_1.ThriftDescriptors.binary('deviceSecret', 20),
|
|
67
|
+
thrift_1.ThriftDescriptors.byte('clientStack', 21),
|
|
68
|
+
thrift_1.ThriftDescriptors.int64('fbnsConnectionKey', 22),
|
|
69
|
+
thrift_1.ThriftDescriptors.binary('fbnsConnectionSecret', 23),
|
|
70
|
+
thrift_1.ThriftDescriptors.binary('fbnsDeviceId', 24),
|
|
71
|
+
thrift_1.ThriftDescriptors.binary('fbnsDeviceSecret', 25),
|
|
72
|
+
thrift_1.ThriftDescriptors.int64('anotherUnknown', 26),
|
|
73
|
+
]),
|
|
74
|
+
thrift_1.ThriftDescriptors.binary('password', 5),
|
|
75
|
+
thrift_1.ThriftDescriptors.int16('unknown', 5),
|
|
76
|
+
thrift_1.ThriftDescriptors.listOfBinary('getDiffsRequests', 6),
|
|
77
|
+
thrift_1.ThriftDescriptors.binary('zeroRatingTokenHash', 9),
|
|
78
|
+
thrift_1.ThriftDescriptors.mapBinaryBinary('appSpecificInfo',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MAAM,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAClD,0BAAiB,CAAC,eAAe,CAAC,iBAAiB,EAAE,EAAE,CAAC;CAC1D,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nodejs-insta-private-api",
|
|
3
|
+
"version": "5.52.1",
|
|
4
|
+
"description": "A pure JavaScript Instagram Private API client with native MQTT real-time messaging support",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "node examples/listen-to-messages.js",
|
|
8
|
+
"start": "node examples/listen-to-messages.js",
|
|
9
|
+
"example": "node complete-example.js",
|
|
10
|
+
"listen": "node complete-example.js"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"instagram",
|
|
14
|
+
"api",
|
|
15
|
+
"private",
|
|
16
|
+
"client",
|
|
17
|
+
"dm",
|
|
18
|
+
"direct",
|
|
19
|
+
"messages",
|
|
20
|
+
"stories",
|
|
21
|
+
"upload",
|
|
22
|
+
"mqtt",
|
|
23
|
+
"realtime",
|
|
24
|
+
"notifications"
|
|
25
|
+
],
|
|
26
|
+
"author": "BorutoSrg",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"axios": "^1.6.0",
|
|
30
|
+
"chance": "^1.1.11",
|
|
31
|
+
"crypto": "^1.0.1",
|
|
32
|
+
"debug": "^4.3.4",
|
|
33
|
+
"eventemitter3": "^5.0.1",
|
|
34
|
+
"form-data": "^4.0.0",
|
|
35
|
+
"lodash": "^4.17.21",
|
|
36
|
+
"mqtt": "^5.10.3",
|
|
37
|
+
"node-persist": "^4.0.4",
|
|
38
|
+
"pako": "^2.1.0",
|
|
39
|
+
"protobufjs": "^7.5.4",
|
|
40
|
+
"socks": "^2.8.1",
|
|
41
|
+
"tough-cookie": "^4.1.3",
|
|
42
|
+
"ts-custom-error": "^3.3.1",
|
|
43
|
+
"uuid": "^9.0.1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"node-fetch": "^3.3.2"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=18.0.0"
|
|
50
|
+
},
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "https://github.com/Kunboruto20/nodejs-insta-private-api.git"
|
|
54
|
+
},
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://github.com/Kunboruto20/nodejs-insta-private-api/issues"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://github.com/Kunboruto20/nodejs-insta-private-api#readme"
|
|
59
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Topic } from '../../topic';
|
|
2
|
+
import { MQTToTClient } from '../../mqttot';
|
|
3
|
+
import * as mqtts_1 from '../../mqtt-shim';
|
|
4
|
+
export declare class Commands {
|
|
5
|
+
private client;
|
|
6
|
+
constructor(client: MQTToTClient);
|
|
7
|
+
private publishToTopic;
|
|
8
|
+
updateSubscriptions(options: {
|
|
9
|
+
topic: Topic;
|
|
10
|
+
data: {
|
|
11
|
+
sub?: string[];
|
|
12
|
+
unsub?: string[];
|
|
13
|
+
} | any;
|
|
14
|
+
}): Promise<MqttMessageOutgoing>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Commands = void 0;
|
|
4
|
+
const shared_1 = require("../../shared");
|
|
5
|
+
|
|
6
|
+
class Commands {
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Publish a compressed payload to a topic.
|
|
13
|
+
* - Forces QoS 0 (no PUBACK wait) because Instagram internal MQTT often
|
|
14
|
+
* doesn't reply PUBACK for these internal topics and QoS1 causes timeouts
|
|
15
|
+
* and reconnect instability.
|
|
16
|
+
* - No-op if client is not connected to avoid "Socket not writable" errors.
|
|
17
|
+
* - Defensive checks: if the client exposes .connected or .isConnected(), respect them.
|
|
18
|
+
*/
|
|
19
|
+
async publishToTopic(topic, compressedData, qos = 0) {
|
|
20
|
+
try {
|
|
21
|
+
// Defensive: ensure we have a client
|
|
22
|
+
if (!this.client) return;
|
|
23
|
+
|
|
24
|
+
// If client exposes a boolean 'connected' flag, respect it
|
|
25
|
+
if (typeof this.client.connected !== 'undefined' && !this.client.connected) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// If client exposes an isConnected() method, respect it
|
|
30
|
+
if (typeof this.client.isConnected === 'function' && !this.client.isConnected()) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Build payload buffer
|
|
35
|
+
const payloadBuf = compressedData instanceof Buffer ? compressedData : Buffer.from(compressedData);
|
|
36
|
+
|
|
37
|
+
// Always publish with QoS 0 for stability on IG edge MQTT
|
|
38
|
+
return this.client.publish({
|
|
39
|
+
topic,
|
|
40
|
+
payload: payloadBuf,
|
|
41
|
+
qosLevel: 0,
|
|
42
|
+
});
|
|
43
|
+
} catch (err) {
|
|
44
|
+
// Swallow non-fatal publish errors. Upper layers/watchdog should handle reconnections.
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* updateSubscriptions used by RealtimeClient for keepalive / subscription refreshes.
|
|
51
|
+
* - Compresses the subscription payload and publishes with QoS 0.
|
|
52
|
+
* - Skips publishing if the MQTT client doesn't appear ready.
|
|
53
|
+
*/
|
|
54
|
+
async updateSubscriptions(options) {
|
|
55
|
+
try {
|
|
56
|
+
if (!this.client) return;
|
|
57
|
+
|
|
58
|
+
// Defensive connection checks
|
|
59
|
+
if (typeof this.client.connected !== 'undefined' && !this.client.connected) return;
|
|
60
|
+
if (typeof this.client.isConnected === 'function' && !this.client.isConnected()) return;
|
|
61
|
+
|
|
62
|
+
const payload = await (0, shared_1.compressDeflate)(JSON.stringify(options.data || {}));
|
|
63
|
+
return this.publishToTopic(options.topic.id, payload, 0);
|
|
64
|
+
} catch (e) {
|
|
65
|
+
// Non-fatal — avoid bubbling errors from keepalive timers
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.Commands = Commands;
|
|
71
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../src/realtime/commands/commands.ts"],"names":[],"mappings":";;;AACA,yCAA+C;AAI/C,MAAa,QAAQ;IAClB,YAA2B,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAE3C,KAAK,CAAC,cAAc,CACzB,KAAa,EACb,cAA+B,EAC/B,GAAU;QAEV,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACxB,KAAK;YACL,OAAO,EAAE,cAAc,YAAY,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC;YACxF,QAAQ,EAAE,GAAG;SACf,CAAC,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAAC,OAGhC;QACE,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,IAAA,wBAAe,EAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxG,CAAC;CACH;AArBD,4BAqBC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { MQTToTClient } from '../../mqttot';
|
|
2
|
+
import { MessageSyncMessageTypes } from '../messages';
|
|
3
|
+
import { ThriftPacketDescriptor } from '../../thrift';
|
|
4
|
+
import * as mqtts_1 from '../../mqtt-shim';
|
|
5
|
+
interface ItemBaseType {
|
|
6
|
+
threadId: string;
|
|
7
|
+
clientContext?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ForegroundState {
|
|
10
|
+
inForegroundApp?: boolean;
|
|
11
|
+
inForegroundDevice?: boolean;
|
|
12
|
+
keepAliveTimeout?: number;
|
|
13
|
+
subscribeTopics?: string[];
|
|
14
|
+
subscribeGenericTopics?: string[];
|
|
15
|
+
unsubscribeTopics?: string[];
|
|
16
|
+
unsubscribeGenericTopics?: string[];
|
|
17
|
+
requestId?: bigint;
|
|
18
|
+
}
|
|
19
|
+
export declare class DirectCommands {
|
|
20
|
+
private directDebug;
|
|
21
|
+
private client;
|
|
22
|
+
private chance;
|
|
23
|
+
foregroundStateConfig: ThriftPacketDescriptor[];
|
|
24
|
+
constructor(client: MQTToTClient);
|
|
25
|
+
sendForegroundState(state: ForegroundState): Promise<MqttMessageOutgoing>;
|
|
26
|
+
private sendCommand;
|
|
27
|
+
private sendItem;
|
|
28
|
+
sendHashtag({ text, threadId, hashtag, clientContext, }: {
|
|
29
|
+
text?: string;
|
|
30
|
+
hashtag: string;
|
|
31
|
+
} & ItemBaseType): Promise<MqttMessageOutgoing>;
|
|
32
|
+
sendLike({ threadId, clientContext }: ItemBaseType): Promise<MqttMessageOutgoing>;
|
|
33
|
+
sendLocation({ text, locationId, threadId, clientContext, }: {
|
|
34
|
+
text?: string;
|
|
35
|
+
locationId: string;
|
|
36
|
+
} & ItemBaseType): Promise<MqttMessageOutgoing>;
|
|
37
|
+
sendMedia({ text, mediaId, threadId, clientContext, }: {
|
|
38
|
+
text?: string;
|
|
39
|
+
mediaId: string;
|
|
40
|
+
} & ItemBaseType): Promise<MqttMessageOutgoing>;
|
|
41
|
+
sendProfile({ text, userId, threadId, clientContext, }: {
|
|
42
|
+
text?: string;
|
|
43
|
+
userId: string;
|
|
44
|
+
} & ItemBaseType): Promise<MqttMessageOutgoing>;
|
|
45
|
+
sendReaction({ itemId, reactionType, clientContext, threadId, reactionStatus, targetItemType, emoji, }: {
|
|
46
|
+
itemId: string;
|
|
47
|
+
reactionType?: 'like' | string;
|
|
48
|
+
reactionStatus?: 'created' | 'deleted';
|
|
49
|
+
targetItemType?: MessageSyncMessageTypes;
|
|
50
|
+
emoji?: string;
|
|
51
|
+
} & ItemBaseType): Promise<MqttMessageOutgoing>;
|
|
52
|
+
sendUserStory({ text, storyId, threadId, clientContext, }: {
|
|
53
|
+
text?: string;
|
|
54
|
+
storyId: string;
|
|
55
|
+
} & ItemBaseType): Promise<MqttMessageOutgoing>;
|
|
56
|
+
sendText({ text, clientContext, threadId }: {
|
|
57
|
+
text: string;
|
|
58
|
+
} & ItemBaseType): Promise<MqttMessageOutgoing>;
|
|
59
|
+
markAsSeen({ threadId, itemId }: {
|
|
60
|
+
threadId: string;
|
|
61
|
+
itemId: string;
|
|
62
|
+
}): Promise<MqttMessageOutgoing>;
|
|
63
|
+
indicateActivity({ threadId, isActive, clientContext }: {
|
|
64
|
+
isActive?: boolean;
|
|
65
|
+
} & ItemBaseType): Promise<MqttMessageOutgoing>;
|
|
66
|
+
deleteMessage(threadId: string, itemId: string): Promise<any>;
|
|
67
|
+
editMessage(threadId: string, itemId: string, newText: string): Promise<any>;
|
|
68
|
+
replyToMessage(threadId: string, messageId: string, replyText: string): Promise<any>;
|
|
69
|
+
subscribeToFollowNotifications(): Promise<any>;
|
|
70
|
+
subscribeToMentionNotifications(): Promise<any>;
|
|
71
|
+
subscribeToCallNotifications(): Promise<any>;
|
|
72
|
+
addMemberToThread(threadId: string, userId: string): Promise<any>;
|
|
73
|
+
removeMemberFromThread(threadId: string, userId: string): Promise<any>;
|
|
74
|
+
}
|
|
75
|
+
export {};
|