nodejs-insta-private-api-mqt 1.3.83 → 1.3.84
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/dist-ts/dist/constants/constants.js +341 -0
- package/dist-ts/dist/constants/index.js +53 -0
- package/dist-ts/dist/core/client.js +437 -0
- package/dist-ts/dist/core/nav-chain.js +252 -0
- package/dist-ts/dist/core/repository.js +6 -0
- package/dist-ts/dist/core/request.js +358 -0
- package/dist-ts/dist/core/state.js +1428 -0
- package/dist-ts/dist/core/utils.js +723 -0
- package/dist-ts/dist/downloadMedia.js +336 -0
- package/dist-ts/dist/errors/index.js +37 -0
- package/dist-ts/dist/extend.js +157 -0
- package/dist-ts/dist/fbns/fbns.client.events.js +2 -0
- package/dist-ts/dist/fbns/fbns.client.js +237 -0
- package/dist-ts/dist/fbns/fbns.device-auth.js +59 -0
- package/dist-ts/dist/fbns/fbns.types.js +2 -0
- package/dist-ts/dist/fbns/fbns.utilities.js +78 -0
- package/dist-ts/dist/fbns/index.js +24 -0
- package/dist-ts/dist/index.js +137 -0
- package/dist-ts/dist/mqtt-shim.js +14 -0
- package/dist-ts/dist/mqttot/index.js +24 -0
- package/dist-ts/dist/mqttot/mqttot.client.js +322 -0
- package/dist-ts/dist/mqttot/mqttot.connect.request.packet.js +8 -0
- package/dist-ts/dist/mqttot/mqttot.connect.response.packet.js +23 -0
- package/dist-ts/dist/mqttot/mqttot.connection.js +68 -0
- package/dist-ts/dist/realtime/commands/commands.js +67 -0
- package/dist-ts/dist/realtime/commands/direct.commands.js +415 -0
- package/dist-ts/dist/realtime/commands/enhanced.direct.commands.js +1529 -0
- package/dist-ts/dist/realtime/commands/index.js +23 -0
- package/dist-ts/dist/realtime/delta-sync.manager.js +260 -0
- package/dist-ts/dist/realtime/features/dm-sender.js +94 -0
- package/dist-ts/dist/realtime/features/error-handler.js +167 -0
- package/dist-ts/dist/realtime/features/gap-handler.js +60 -0
- package/dist-ts/dist/realtime/features/persistent-logger.js +174 -0
- package/dist-ts/dist/realtime/features/presence.manager.js +68 -0
- package/dist-ts/dist/realtime/features/session-health-monitor.js +327 -0
- package/dist-ts/dist/realtime/index.js +21 -0
- package/dist-ts/dist/realtime/messages/app-presence.event.js +2 -0
- package/dist-ts/dist/realtime/messages/index.js +23 -0
- package/dist-ts/dist/realtime/messages/message-sync.message.js +42 -0
- package/dist-ts/dist/realtime/messages/realtime-sub.direct.data.js +2 -0
- package/dist-ts/dist/realtime/messages/thread-update.message.js +2 -0
- package/dist-ts/dist/realtime/mixins/index.js +23 -0
- package/dist-ts/dist/realtime/mixins/message-sync.mixin.js +585 -0
- package/dist-ts/dist/realtime/mixins/mixin.js +40 -0
- package/dist-ts/dist/realtime/mixins/presence-typing.mixin.js +29 -0
- package/dist-ts/dist/realtime/mixins/realtime-sub.mixin.js +171 -0
- package/dist-ts/dist/realtime/parsers/graphql-parser.js +43 -0
- package/dist-ts/dist/realtime/parsers/graphql.parser.js +22 -0
- package/dist-ts/dist/realtime/parsers/index.js +26 -0
- package/dist-ts/dist/realtime/parsers/iris-parser.js +43 -0
- package/dist-ts/dist/realtime/parsers/iris.parser.js +9 -0
- package/dist-ts/dist/realtime/parsers/json-parser.js +43 -0
- package/dist-ts/dist/realtime/parsers/json.parser.js +9 -0
- package/dist-ts/dist/realtime/parsers/parser.js +2 -0
- package/dist-ts/dist/realtime/parsers/region-hint-parser.js +43 -0
- package/dist-ts/dist/realtime/parsers/region-hint.parser.js +14 -0
- package/dist-ts/dist/realtime/parsers/skywalker-parser.js +43 -0
- package/dist-ts/dist/realtime/parsers/skywalker.parser.js +14 -0
- package/dist-ts/dist/realtime/parsers-advanced.js +138 -0
- package/dist-ts/dist/realtime/proto-parser.js +186 -0
- package/dist-ts/dist/realtime/protocols/iris.handshake.js +76 -0
- package/dist-ts/dist/realtime/protocols/skywalker.protocol.js +96 -0
- package/dist-ts/dist/realtime/realtime.client.events.js +2 -0
- package/dist-ts/dist/realtime/realtime.client.js +2117 -0
- package/dist-ts/dist/realtime/realtime.service.js +408 -0
- package/dist-ts/dist/realtime/reconnect.manager.js +72 -0
- package/dist-ts/dist/realtime/session.manager.js +106 -0
- package/dist-ts/dist/realtime/subscriptions/graphql.subscription.js +98 -0
- package/dist-ts/dist/realtime/subscriptions/index.js +22 -0
- package/dist-ts/dist/realtime/subscriptions/skywalker.subscription.js +12 -0
- package/dist-ts/dist/realtime/topic-map.js +57 -0
- package/dist-ts/dist/realtime/topic.js +76 -0
- package/dist-ts/dist/repositories/account.repository.js +1267 -0
- package/dist-ts/dist/repositories/bloks.repository.js +66 -0
- package/dist-ts/dist/repositories/captcha.repository.js +40 -0
- package/dist-ts/dist/repositories/challenge.repository.js +108 -0
- package/dist-ts/dist/repositories/clip.repository.js +134 -0
- package/dist-ts/dist/repositories/close-friends.repository.js +41 -0
- package/dist-ts/dist/repositories/collection.repository.js +64 -0
- package/dist-ts/dist/repositories/direct-thread.repository.js +423 -0
- package/dist-ts/dist/repositories/direct.repository.js +246 -0
- package/dist-ts/dist/repositories/explore.repository.js +60 -0
- package/dist-ts/dist/repositories/fbsearch.repository.js +124 -0
- package/dist-ts/dist/repositories/feed.repository.js +237 -0
- package/dist-ts/dist/repositories/friendship.repository.js +277 -0
- package/dist-ts/dist/repositories/fundraiser.repository.js +38 -0
- package/dist-ts/dist/repositories/hashtag.repository.js +80 -0
- package/dist-ts/dist/repositories/highlights.repository.js +100 -0
- package/dist-ts/dist/repositories/insights.repository.js +66 -0
- package/dist-ts/dist/repositories/location.repository.js +67 -0
- package/dist-ts/dist/repositories/media.repository.js +370 -0
- package/dist-ts/dist/repositories/multiple-accounts.repository.js +36 -0
- package/dist-ts/dist/repositories/news.repository.js +32 -0
- package/dist-ts/dist/repositories/note.repository.js +51 -0
- package/dist-ts/dist/repositories/notification.repository.js +77 -0
- package/dist-ts/dist/repositories/share.repository.js +34 -0
- package/dist-ts/dist/repositories/signup.repository.js +178 -0
- package/dist-ts/dist/repositories/story.repository.js +268 -0
- package/dist-ts/dist/repositories/timeline.repository.js +57 -0
- package/dist-ts/dist/repositories/totp.repository.js +124 -0
- package/dist-ts/dist/repositories/track.repository.js +50 -0
- package/dist-ts/dist/repositories/upload.repository.js +191 -0
- package/dist-ts/dist/repositories/user.repository.js +332 -0
- package/dist-ts/dist/sendmedia/index.js +24 -0
- package/dist-ts/dist/sendmedia/sendFile.js +56 -0
- package/dist-ts/dist/sendmedia/sendPhoto.js +132 -0
- package/dist-ts/dist/sendmedia/sendRavenPhoto.js +133 -0
- package/dist-ts/dist/sendmedia/sendRavenVideo.js +136 -0
- package/dist-ts/dist/sendmedia/uploadPhoto.js +89 -0
- package/dist-ts/dist/sendmedia/uploadfFile.js +108 -0
- package/dist-ts/dist/services/live.service.js +113 -0
- package/dist-ts/dist/services/search.service.js +91 -0
- package/dist-ts/dist/shared/index.js +98 -0
- package/dist-ts/dist/shared/shared.js +85 -0
- package/dist-ts/dist/thrift/index.js +23 -0
- package/dist-ts/dist/thrift/thrift.js +105 -0
- package/dist-ts/dist/thrift/thrift.reading.js +339 -0
- package/dist-ts/dist/thrift/thrift.writing.js +393 -0
- package/dist-ts/dist/types/index.js +276 -0
- package/dist-ts/dist/useMultiFileAuthState.js +1878 -0
- package/dist-ts/dist/utils/index.js +244 -0
- package/dist-ts/examples/listen-to-messages.js +73 -0
- package/package.json +1 -1
- package/src-ts/dist/realtime/protocols/proto-definitions.ts +80 -0
- package/src-ts/dist/utils/helper-1.ts +1 -0
- package/src-ts/dist/utils/helper-10.ts +1 -0
- package/src-ts/dist/utils/helper-11.ts +1 -0
- package/src-ts/dist/utils/helper-12.ts +1 -0
- package/src-ts/dist/utils/helper-13.ts +1 -0
- package/src-ts/dist/utils/helper-14.ts +1 -0
- package/src-ts/dist/utils/helper-15.ts +1 -0
- package/src-ts/dist/utils/helper-16.ts +1 -0
- package/src-ts/dist/utils/helper-17.ts +1 -0
- package/src-ts/dist/utils/helper-18.ts +1 -0
- package/src-ts/dist/utils/helper-19.ts +1 -0
- package/src-ts/dist/utils/helper-2.ts +1 -0
- package/src-ts/dist/utils/helper-20.ts +1 -0
- package/src-ts/dist/utils/helper-21.ts +1 -0
- package/src-ts/dist/utils/helper-22.ts +1 -0
- package/src-ts/dist/utils/helper-23.ts +1 -0
- package/src-ts/dist/utils/helper-24.ts +1 -0
- package/src-ts/dist/utils/helper-25.ts +1 -0
- package/src-ts/dist/utils/helper-26.ts +1 -0
- package/src-ts/dist/utils/helper-27.ts +1 -0
- package/src-ts/dist/utils/helper-28.ts +1 -0
- package/src-ts/dist/utils/helper-29.ts +1 -0
- package/src-ts/dist/utils/helper-3.ts +1 -0
- package/src-ts/dist/utils/helper-30.ts +1 -0
- package/src-ts/dist/utils/helper-4.ts +1 -0
- package/src-ts/dist/utils/helper-5.ts +1 -0
- package/src-ts/dist/utils/helper-6.ts +1 -0
- package/src-ts/dist/utils/helper-7.ts +1 -0
- package/src-ts/dist/utils/helper-8.ts +1 -0
- package/src-ts/dist/utils/helper-9.ts +1 -0
- package/src-ts/dist/utils/insta-mqtt-helper.ts +128 -0
- package/src-ts/examples/listen-to-messages.ts +86 -0
- package/dist/errors/index.d.ts +0 -16
- package/dist/errors/index.js.map +0 -1
- package/dist/fbns/fbns.client.d.ts +0 -32
- package/dist/fbns/fbns.client.events.d.ts +0 -41
- package/dist/fbns/fbns.client.events.js.map +0 -1
- package/dist/fbns/fbns.client.js.map +0 -1
- package/dist/fbns/fbns.device-auth.d.ts +0 -17
- package/dist/fbns/fbns.device-auth.js.map +0 -1
- package/dist/fbns/fbns.types.d.ts +0 -83
- package/dist/fbns/fbns.types.js.map +0 -1
- package/dist/fbns/fbns.utilities.d.ts +0 -2
- package/dist/fbns/fbns.utilities.js.map +0 -1
- package/dist/fbns/index.d.ts +0 -4
- package/dist/fbns/index.js.map +0 -1
- package/dist/mqtt-shim.d.ts +0 -96
- package/dist/mqttot/index.d.ts +0 -4
- package/dist/mqttot/index.js.map +0 -1
- package/dist/mqttot/mqttot.client.d.ts +0 -39
- package/dist/mqttot/mqttot.client.js.map +0 -1
- package/dist/mqttot/mqttot.connect.request.packet.d.ts +0 -7
- package/dist/mqttot/mqttot.connect.request.packet.js.map +0 -1
- package/dist/mqttot/mqttot.connect.response.packet.d.ts +0 -7
- package/dist/mqttot/mqttot.connect.response.packet.js.map +0 -1
- package/dist/mqttot/mqttot.connection.d.ts +0 -57
- package/dist/mqttot/mqttot.connection.js.map +0 -1
- package/dist/package.json +0 -59
- package/dist/realtime/commands/commands.d.ts +0 -15
- package/dist/realtime/commands/commands.js.map +0 -1
- package/dist/realtime/commands/direct.commands.d.ts +0 -75
- package/dist/realtime/commands/direct.commands.js.map +0 -1
- package/dist/realtime/commands/enhanced.direct.commands.js.bak +0 -967
- package/dist/realtime/commands/index.d.ts +0 -2
- package/dist/realtime/commands/index.js.map +0 -1
- package/dist/realtime/messages/app-presence.event.d.ts +0 -9
- package/dist/realtime/messages/app-presence.event.js.map +0 -1
- package/dist/realtime/messages/index.d.ts +0 -3
- package/dist/realtime/messages/index.js.map +0 -1
- package/dist/realtime/messages/message-sync.message.d.ts +0 -222
- package/dist/realtime/messages/message-sync.message.js.map +0 -1
- package/dist/realtime/messages/realtime-sub.direct.data.d.ts +0 -11
- package/dist/realtime/messages/realtime-sub.direct.data.js.map +0 -1
- package/dist/realtime/messages/thread-update.message.d.ts +0 -68
- package/dist/realtime/messages/thread-update.message.js.map +0 -1
- package/dist/realtime/mixins/index.d.ts +0 -3
- package/dist/realtime/mixins/index.js.map +0 -1
- package/dist/realtime/mixins/message-sync.mixin.d.ts +0 -8
- package/dist/realtime/mixins/message-sync.mixin.js.map +0 -1
- package/dist/realtime/mixins/mixin.d.ts +0 -19
- package/dist/realtime/mixins/mixin.js.map +0 -1
- package/dist/realtime/mixins/realtime-sub.mixin.d.ts +0 -8
- package/dist/realtime/mixins/realtime-sub.mixin.js.map +0 -1
- package/dist/realtime/parsers/graphql.parser.d.ts +0 -15
- package/dist/realtime/parsers/graphql.parser.js.map +0 -1
- package/dist/realtime/parsers/index.d.ts +0 -6
- package/dist/realtime/parsers/index.js.map +0 -1
- package/dist/realtime/parsers/iris.parser.d.ts +0 -17
- package/dist/realtime/parsers/iris.parser.js.map +0 -1
- package/dist/realtime/parsers/json.parser.d.ts +0 -6
- package/dist/realtime/parsers/json.parser.js.map +0 -1
- package/dist/realtime/parsers/parser.d.ts +0 -9
- package/dist/realtime/parsers/parser.js.map +0 -1
- package/dist/realtime/parsers/region-hint.parser.d.ts +0 -12
- package/dist/realtime/parsers/region-hint.parser.js.map +0 -1
- package/dist/realtime/parsers/skywalker.parser.d.ts +0 -12
- package/dist/realtime/parsers/skywalker.parser.js.map +0 -1
- package/dist/realtime/proto/common.proto +0 -38
- package/dist/realtime/proto/direct.proto +0 -65
- package/dist/realtime/proto/ig-messages.proto +0 -83
- package/dist/realtime/proto/iris.proto +0 -188
- package/dist/realtime/subscriptions/graphql.subscription.d.ts +0 -47
- package/dist/realtime/subscriptions/graphql.subscription.js.map +0 -1
- package/dist/realtime/subscriptions/index.d.ts +0 -2
- package/dist/realtime/subscriptions/index.js.map +0 -1
- package/dist/realtime/subscriptions/skywalker.subscription.d.ts +0 -4
- package/dist/realtime/subscriptions/skywalker.subscription.js.map +0 -1
- package/dist/thrift/index.d.ts +0 -3
- package/dist/thrift/index.js.map +0 -1
- package/dist/thrift/thrift.d.ts +0 -59
- package/dist/thrift/thrift.js.map +0 -1
- package/dist/thrift/thrift.reading.d.ts +0 -41
- package/dist/thrift/thrift.reading.js.map +0 -1
- package/dist/thrift/thrift.writing.d.ts +0 -44
- package/dist/thrift/thrift.writing.js.map +0 -1
- /package/{dist → dist-ts/dist}/realtime/protocols/proto-definitions.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-1.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-10.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-11.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-12.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-13.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-14.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-15.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-16.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-17.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-18.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-19.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-2.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-20.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-21.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-22.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-23.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-24.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-25.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-26.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-27.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-28.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-29.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-3.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-30.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-4.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-5.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-6.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-7.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-8.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-9.js +0 -0
- /package/{dist → dist-ts/dist}/utils/insta-mqtt-helper.js +0 -0
- /package/{dist/constants/constants.js → src-ts/dist/constants/constants.ts} +0 -0
- /package/{dist/constants/index.js → src-ts/dist/constants/index.ts} +0 -0
- /package/{dist/core/client.js → src-ts/dist/core/client.ts} +0 -0
- /package/{dist/core/nav-chain.js → src-ts/dist/core/nav-chain.ts} +0 -0
- /package/{dist/core/repository.js → src-ts/dist/core/repository.ts} +0 -0
- /package/{dist/core/request.js → src-ts/dist/core/request.ts} +0 -0
- /package/{dist/core/state.js → src-ts/dist/core/state.ts} +0 -0
- /package/{dist/core/utils.js → src-ts/dist/core/utils.ts} +0 -0
- /package/{dist/downloadMedia.js → src-ts/dist/downloadMedia.ts} +0 -0
- /package/{dist/errors/index.js → src-ts/dist/errors/index.ts} +0 -0
- /package/{dist/extend.js → src-ts/dist/extend.ts} +0 -0
- /package/{dist/fbns/fbns.client.events.js → src-ts/dist/fbns/fbns.client.events.ts} +0 -0
- /package/{dist/fbns/fbns.client.js → src-ts/dist/fbns/fbns.client.ts} +0 -0
- /package/{dist/fbns/fbns.device-auth.js → src-ts/dist/fbns/fbns.device-auth.ts} +0 -0
- /package/{dist/fbns/fbns.types.js → src-ts/dist/fbns/fbns.types.ts} +0 -0
- /package/{dist/fbns/fbns.utilities.js → src-ts/dist/fbns/fbns.utilities.ts} +0 -0
- /package/{dist/fbns/index.js → src-ts/dist/fbns/index.ts} +0 -0
- /package/{dist/index.js → src-ts/dist/index.ts} +0 -0
- /package/{dist/mqtt-shim.js → src-ts/dist/mqtt-shim.ts} +0 -0
- /package/{dist/mqttot/index.js → src-ts/dist/mqttot/index.ts} +0 -0
- /package/{dist/mqttot/mqttot.client.js → src-ts/dist/mqttot/mqttot.client.ts} +0 -0
- /package/{dist/mqttot/mqttot.connect.request.packet.js → src-ts/dist/mqttot/mqttot.connect.request.packet.ts} +0 -0
- /package/{dist/mqttot/mqttot.connect.response.packet.js → src-ts/dist/mqttot/mqttot.connect.response.packet.ts} +0 -0
- /package/{dist/mqttot/mqttot.connection.js → src-ts/dist/mqttot/mqttot.connection.ts} +0 -0
- /package/{dist/realtime/commands/commands.js → src-ts/dist/realtime/commands/commands.ts} +0 -0
- /package/{dist/realtime/commands/direct.commands.js → src-ts/dist/realtime/commands/direct.commands.ts} +0 -0
- /package/{dist/realtime/commands/enhanced.direct.commands.js → src-ts/dist/realtime/commands/enhanced.direct.commands.ts} +0 -0
- /package/{dist/realtime/commands/index.js → src-ts/dist/realtime/commands/index.ts} +0 -0
- /package/{dist/realtime/delta-sync.manager.js → src-ts/dist/realtime/delta-sync.manager.ts} +0 -0
- /package/{dist/realtime/features/dm-sender.js → src-ts/dist/realtime/features/dm-sender.ts} +0 -0
- /package/{dist/realtime/features/error-handler.js → src-ts/dist/realtime/features/error-handler.ts} +0 -0
- /package/{dist/realtime/features/gap-handler.js → src-ts/dist/realtime/features/gap-handler.ts} +0 -0
- /package/{dist/realtime/features/persistent-logger.js → src-ts/dist/realtime/features/persistent-logger.ts} +0 -0
- /package/{dist/realtime/features/presence.manager.js → src-ts/dist/realtime/features/presence.manager.ts} +0 -0
- /package/{dist/realtime/features/session-health-monitor.js → src-ts/dist/realtime/features/session-health-monitor.ts} +0 -0
- /package/{dist/realtime/index.js → src-ts/dist/realtime/index.ts} +0 -0
- /package/{dist/realtime/messages/app-presence.event.js → src-ts/dist/realtime/messages/app-presence.event.ts} +0 -0
- /package/{dist/realtime/messages/index.js → src-ts/dist/realtime/messages/index.ts} +0 -0
- /package/{dist/realtime/messages/message-sync.message.js → src-ts/dist/realtime/messages/message-sync.message.ts} +0 -0
- /package/{dist/realtime/messages/realtime-sub.direct.data.js → src-ts/dist/realtime/messages/realtime-sub.direct.data.ts} +0 -0
- /package/{dist/realtime/messages/thread-update.message.js → src-ts/dist/realtime/messages/thread-update.message.ts} +0 -0
- /package/{dist/realtime/mixins/index.js → src-ts/dist/realtime/mixins/index.ts} +0 -0
- /package/{dist/realtime/mixins/message-sync.mixin.js → src-ts/dist/realtime/mixins/message-sync.mixin.ts} +0 -0
- /package/{dist/realtime/mixins/mixin.js → src-ts/dist/realtime/mixins/mixin.ts} +0 -0
- /package/{dist/realtime/mixins/presence-typing.mixin.js → src-ts/dist/realtime/mixins/presence-typing.mixin.ts} +0 -0
- /package/{dist/realtime/mixins/realtime-sub.mixin.js → src-ts/dist/realtime/mixins/realtime-sub.mixin.ts} +0 -0
- /package/{dist/realtime/parsers/graphql-parser.js → src-ts/dist/realtime/parsers/graphql-parser.ts} +0 -0
- /package/{dist/realtime/parsers/graphql.parser.js → src-ts/dist/realtime/parsers/graphql.parser.ts} +0 -0
- /package/{dist/realtime/parsers/index.js → src-ts/dist/realtime/parsers/index.ts} +0 -0
- /package/{dist/realtime/parsers/iris-parser.js → src-ts/dist/realtime/parsers/iris-parser.ts} +0 -0
- /package/{dist/realtime/parsers/iris.parser.js → src-ts/dist/realtime/parsers/iris.parser.ts} +0 -0
- /package/{dist/realtime/parsers/json-parser.js → src-ts/dist/realtime/parsers/json-parser.ts} +0 -0
- /package/{dist/realtime/parsers/json.parser.js → src-ts/dist/realtime/parsers/json.parser.ts} +0 -0
- /package/{dist/realtime/parsers/parser.js → src-ts/dist/realtime/parsers/parser.ts} +0 -0
- /package/{dist/realtime/parsers/region-hint-parser.js → src-ts/dist/realtime/parsers/region-hint-parser.ts} +0 -0
- /package/{dist/realtime/parsers/region-hint.parser.js → src-ts/dist/realtime/parsers/region-hint.parser.ts} +0 -0
- /package/{dist/realtime/parsers/skywalker-parser.js → src-ts/dist/realtime/parsers/skywalker-parser.ts} +0 -0
- /package/{dist/realtime/parsers/skywalker.parser.js → src-ts/dist/realtime/parsers/skywalker.parser.ts} +0 -0
- /package/{dist/realtime/parsers-advanced.js → src-ts/dist/realtime/parsers-advanced.ts} +0 -0
- /package/{dist/realtime/proto-parser.js → src-ts/dist/realtime/proto-parser.ts} +0 -0
- /package/{dist/realtime/protocols/iris.handshake.js → src-ts/dist/realtime/protocols/iris.handshake.ts} +0 -0
- /package/{dist/realtime/protocols/skywalker.protocol.js → src-ts/dist/realtime/protocols/skywalker.protocol.ts} +0 -0
- /package/{dist/realtime/realtime.client.events.js → src-ts/dist/realtime/realtime.client.events.ts} +0 -0
- /package/{dist/realtime/realtime.client.js → src-ts/dist/realtime/realtime.client.ts} +0 -0
- /package/{dist/realtime/realtime.service.js → src-ts/dist/realtime/realtime.service.ts} +0 -0
- /package/{dist/realtime/reconnect.manager.js → src-ts/dist/realtime/reconnect.manager.ts} +0 -0
- /package/{dist/realtime/session.manager.js → src-ts/dist/realtime/session.manager.ts} +0 -0
- /package/{dist/realtime/subscriptions/graphql.subscription.js → src-ts/dist/realtime/subscriptions/graphql.subscription.ts} +0 -0
- /package/{dist/realtime/subscriptions/index.js → src-ts/dist/realtime/subscriptions/index.ts} +0 -0
- /package/{dist/realtime/subscriptions/skywalker.subscription.js → src-ts/dist/realtime/subscriptions/skywalker.subscription.ts} +0 -0
- /package/{dist/realtime/topic-map.js → src-ts/dist/realtime/topic-map.ts} +0 -0
- /package/{dist/realtime/topic.js → src-ts/dist/realtime/topic.ts} +0 -0
- /package/{dist/repositories/account.repository.js → src-ts/dist/repositories/account.repository.ts} +0 -0
- /package/{dist/repositories/bloks.repository.js → src-ts/dist/repositories/bloks.repository.ts} +0 -0
- /package/{dist/repositories/captcha.repository.js → src-ts/dist/repositories/captcha.repository.ts} +0 -0
- /package/{dist/repositories/challenge.repository.js → src-ts/dist/repositories/challenge.repository.ts} +0 -0
- /package/{dist/repositories/clip.repository.js → src-ts/dist/repositories/clip.repository.ts} +0 -0
- /package/{dist/repositories/close-friends.repository.js → src-ts/dist/repositories/close-friends.repository.ts} +0 -0
- /package/{dist/repositories/collection.repository.js → src-ts/dist/repositories/collection.repository.ts} +0 -0
- /package/{dist/repositories/direct-thread.repository.js → src-ts/dist/repositories/direct-thread.repository.ts} +0 -0
- /package/{dist/repositories/direct.repository.js → src-ts/dist/repositories/direct.repository.ts} +0 -0
- /package/{dist/repositories/explore.repository.js → src-ts/dist/repositories/explore.repository.ts} +0 -0
- /package/{dist/repositories/fbsearch.repository.js → src-ts/dist/repositories/fbsearch.repository.ts} +0 -0
- /package/{dist/repositories/feed.repository.js → src-ts/dist/repositories/feed.repository.ts} +0 -0
- /package/{dist/repositories/friendship.repository.js → src-ts/dist/repositories/friendship.repository.ts} +0 -0
- /package/{dist/repositories/fundraiser.repository.js → src-ts/dist/repositories/fundraiser.repository.ts} +0 -0
- /package/{dist/repositories/hashtag.repository.js → src-ts/dist/repositories/hashtag.repository.ts} +0 -0
- /package/{dist/repositories/highlights.repository.js → src-ts/dist/repositories/highlights.repository.ts} +0 -0
- /package/{dist/repositories/insights.repository.js → src-ts/dist/repositories/insights.repository.ts} +0 -0
- /package/{dist/repositories/location.repository.js → src-ts/dist/repositories/location.repository.ts} +0 -0
- /package/{dist/repositories/media.repository.js → src-ts/dist/repositories/media.repository.ts} +0 -0
- /package/{dist/repositories/multiple-accounts.repository.js → src-ts/dist/repositories/multiple-accounts.repository.ts} +0 -0
- /package/{dist/repositories/news.repository.js → src-ts/dist/repositories/news.repository.ts} +0 -0
- /package/{dist/repositories/note.repository.js → src-ts/dist/repositories/note.repository.ts} +0 -0
- /package/{dist/repositories/notification.repository.js → src-ts/dist/repositories/notification.repository.ts} +0 -0
- /package/{dist/repositories/share.repository.js → src-ts/dist/repositories/share.repository.ts} +0 -0
- /package/{dist/repositories/signup.repository.js → src-ts/dist/repositories/signup.repository.ts} +0 -0
- /package/{dist/repositories/story.repository.js → src-ts/dist/repositories/story.repository.ts} +0 -0
- /package/{dist/repositories/timeline.repository.js → src-ts/dist/repositories/timeline.repository.ts} +0 -0
- /package/{dist/repositories/totp.repository.js → src-ts/dist/repositories/totp.repository.ts} +0 -0
- /package/{dist/repositories/track.repository.js → src-ts/dist/repositories/track.repository.ts} +0 -0
- /package/{dist/repositories/upload.repository.js → src-ts/dist/repositories/upload.repository.ts} +0 -0
- /package/{dist/repositories/user.repository.js → src-ts/dist/repositories/user.repository.ts} +0 -0
- /package/{dist/sendmedia/index.js → src-ts/dist/sendmedia/index.ts} +0 -0
- /package/{dist/sendmedia/sendFile.js → src-ts/dist/sendmedia/sendFile.ts} +0 -0
- /package/{dist/sendmedia/sendPhoto.js → src-ts/dist/sendmedia/sendPhoto.ts} +0 -0
- /package/{dist/sendmedia/sendRavenPhoto.js → src-ts/dist/sendmedia/sendRavenPhoto.ts} +0 -0
- /package/{dist/sendmedia/sendRavenVideo.js → src-ts/dist/sendmedia/sendRavenVideo.ts} +0 -0
- /package/{dist/sendmedia/uploadPhoto.js → src-ts/dist/sendmedia/uploadPhoto.ts} +0 -0
- /package/{dist/sendmedia/uploadfFile.js → src-ts/dist/sendmedia/uploadfFile.ts} +0 -0
- /package/{dist/services/live.service.js → src-ts/dist/services/live.service.ts} +0 -0
- /package/{dist/services/search.service.js → src-ts/dist/services/search.service.ts} +0 -0
- /package/{dist/shared/index.js → src-ts/dist/shared/index.ts} +0 -0
- /package/{dist/shared/shared.js → src-ts/dist/shared/shared.ts} +0 -0
- /package/{dist/thrift/index.js → src-ts/dist/thrift/index.ts} +0 -0
- /package/{dist/thrift/thrift.reading.js → src-ts/dist/thrift/thrift.reading.ts} +0 -0
- /package/{dist/thrift/thrift.js → src-ts/dist/thrift/thrift.ts} +0 -0
- /package/{dist/thrift/thrift.writing.js → src-ts/dist/thrift/thrift.writing.ts} +0 -0
- /package/{dist/types/index.js → src-ts/dist/types/index.ts} +0 -0
- /package/{dist/useMultiFileAuthState.js → src-ts/dist/useMultiFileAuthState.ts} +0 -0
- /package/{dist/utils/index.js → src-ts/dist/utils/index.ts} +0 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
const Repository = require('../core/repository');
|
|
2
|
+
const Chance = require('chance');
|
|
3
|
+
const { random } = require('lodash');
|
|
4
|
+
const FormData = require('form-data');
|
|
5
|
+
class UploadRepository extends Repository {
|
|
6
|
+
constructor(client) {
|
|
7
|
+
super(client);
|
|
8
|
+
this.chance = new Chance();
|
|
9
|
+
}
|
|
10
|
+
async photo(options) {
|
|
11
|
+
const uploadId = options.uploadId || Date.now();
|
|
12
|
+
const name = `${uploadId}_0_${random(1000000000, 9999999999)}`;
|
|
13
|
+
const waterfallId = options.waterfallId || this.chance.guid();
|
|
14
|
+
const ruploadParams = this.createPhotoRuploadParams(options, uploadId);
|
|
15
|
+
const response = await this.client.request.send({
|
|
16
|
+
url: `/rupload_igphoto/${name}`,
|
|
17
|
+
method: 'POST',
|
|
18
|
+
headers: {
|
|
19
|
+
'X_FB_PHOTO_WATERFALL_ID': waterfallId,
|
|
20
|
+
'X-Entity-Type': 'image/jpeg',
|
|
21
|
+
'Offset': '0',
|
|
22
|
+
'X-Instagram-Rupload-Params': JSON.stringify(ruploadParams),
|
|
23
|
+
'X-Entity-Name': name,
|
|
24
|
+
'X-Entity-Length': options.file.length.toString(),
|
|
25
|
+
'Content-Type': 'application/octet-stream',
|
|
26
|
+
'Content-Length': options.file.length.toString(),
|
|
27
|
+
'Accept-Encoding': 'gzip',
|
|
28
|
+
},
|
|
29
|
+
body: options.file,
|
|
30
|
+
});
|
|
31
|
+
return response.body;
|
|
32
|
+
}
|
|
33
|
+
async video(options) {
|
|
34
|
+
const uploadId = options.uploadId || Date.now();
|
|
35
|
+
const name = options.uploadName || `${uploadId}_0_${random(1000000000, 9999999999)}`;
|
|
36
|
+
const waterfallId = options.waterfallId || this.chance.guid();
|
|
37
|
+
const ruploadParams = this.createVideoRuploadParams(options, uploadId);
|
|
38
|
+
const response = await this.client.request.send({
|
|
39
|
+
url: `/rupload_igvideo/${name}`,
|
|
40
|
+
method: 'POST',
|
|
41
|
+
headers: {
|
|
42
|
+
'X_FB_VIDEO_WATERFALL_ID': waterfallId,
|
|
43
|
+
'X-Entity-Type': 'video/mp4',
|
|
44
|
+
'Offset': options.offset || '0',
|
|
45
|
+
'X-Instagram-Rupload-Params': JSON.stringify(ruploadParams),
|
|
46
|
+
'X-Entity-Name': name,
|
|
47
|
+
'X-Entity-Length': options.video.length.toString(),
|
|
48
|
+
'Content-Type': 'application/octet-stream',
|
|
49
|
+
'Content-Length': options.video.length.toString(),
|
|
50
|
+
'Accept-Encoding': 'gzip',
|
|
51
|
+
},
|
|
52
|
+
body: options.video,
|
|
53
|
+
});
|
|
54
|
+
return response.body;
|
|
55
|
+
}
|
|
56
|
+
createPhotoRuploadParams(options, uploadId) {
|
|
57
|
+
const params = {
|
|
58
|
+
retry_context: JSON.stringify({
|
|
59
|
+
num_step_auto_retry: 0,
|
|
60
|
+
num_reupload: 0,
|
|
61
|
+
num_step_manual_retry: 0,
|
|
62
|
+
}),
|
|
63
|
+
media_type: '1',
|
|
64
|
+
xsharing_user_ids: JSON.stringify([]),
|
|
65
|
+
upload_id: uploadId.toString(),
|
|
66
|
+
image_compression: JSON.stringify({
|
|
67
|
+
lib_name: 'moz',
|
|
68
|
+
lib_version: '3.1.m',
|
|
69
|
+
quality: '80',
|
|
70
|
+
}),
|
|
71
|
+
};
|
|
72
|
+
if (options.for_album)
|
|
73
|
+
params.is_sidecar = '1';
|
|
74
|
+
if (options.isClip)
|
|
75
|
+
params.is_clips_video = '1';
|
|
76
|
+
return params;
|
|
77
|
+
}
|
|
78
|
+
createVideoRuploadParams(options, uploadId) {
|
|
79
|
+
const params = {
|
|
80
|
+
retry_context: JSON.stringify({
|
|
81
|
+
num_step_auto_retry: 0,
|
|
82
|
+
num_reupload: 0,
|
|
83
|
+
num_step_manual_retry: 0,
|
|
84
|
+
}),
|
|
85
|
+
media_type: '2',
|
|
86
|
+
xsharing_user_ids: JSON.stringify([]),
|
|
87
|
+
upload_id: uploadId.toString(),
|
|
88
|
+
upload_media_duration_ms: options.duration_ms || '0',
|
|
89
|
+
upload_media_width: options.width || '720',
|
|
90
|
+
upload_media_height: options.height || '1280',
|
|
91
|
+
};
|
|
92
|
+
if (options.for_album)
|
|
93
|
+
params.is_sidecar = '1';
|
|
94
|
+
if (options.isClip) {
|
|
95
|
+
params.is_clips_video = '1';
|
|
96
|
+
params.clips_uses_original_audio = '1';
|
|
97
|
+
}
|
|
98
|
+
return params;
|
|
99
|
+
}
|
|
100
|
+
async configure(options) {
|
|
101
|
+
var _a, _b, _c, _d;
|
|
102
|
+
const basePayload = {
|
|
103
|
+
upload_id: options.uploadId,
|
|
104
|
+
source_type: options.source_type || '4',
|
|
105
|
+
camera_position: options.camera_position || 'back',
|
|
106
|
+
_uid: this.client.state.cookieUserId,
|
|
107
|
+
_uuid: this.client.state.uuid,
|
|
108
|
+
creation_logger_session_id: this.chance.guid(),
|
|
109
|
+
device: {
|
|
110
|
+
manufacturer: ((_a = this.client.state.devicePayload) === null || _a === void 0 ? void 0 : _a.manufacturer) || 'samsung',
|
|
111
|
+
model: ((_b = this.client.state.devicePayload) === null || _b === void 0 ? void 0 : _b.model) || 'SM-S928B',
|
|
112
|
+
android_version: ((_c = this.client.state.devicePayload) === null || _c === void 0 ? void 0 : _c.android_version) || 35,
|
|
113
|
+
android_release: ((_d = this.client.state.devicePayload) === null || _d === void 0 ? void 0 : _d.android_release) || '15',
|
|
114
|
+
},
|
|
115
|
+
length: options.length || 0,
|
|
116
|
+
audio_muted: options.audio_muted || false,
|
|
117
|
+
poster_frame_index: options.poster_frame_index || 0,
|
|
118
|
+
filter_type: options.filter_type || '0',
|
|
119
|
+
video_result: options.video_result || '',
|
|
120
|
+
composition_id: this.chance.guid(),
|
|
121
|
+
clips: options.clips || [
|
|
122
|
+
{
|
|
123
|
+
length: options.length || 0,
|
|
124
|
+
source_type: '4',
|
|
125
|
+
camera_position: 'back',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
};
|
|
129
|
+
if (options.caption)
|
|
130
|
+
basePayload.caption = options.caption;
|
|
131
|
+
if (options.configure_mode)
|
|
132
|
+
basePayload.configure_mode = options.configure_mode;
|
|
133
|
+
if (options.location)
|
|
134
|
+
basePayload.location = JSON.stringify(options.location);
|
|
135
|
+
if (options.usertags)
|
|
136
|
+
basePayload.usertags = JSON.stringify({ in: options.usertags });
|
|
137
|
+
const response = await this.client.request.send({
|
|
138
|
+
url: '/api/v1/media/configure/',
|
|
139
|
+
method: 'POST',
|
|
140
|
+
form: this.client.request.sign(basePayload),
|
|
141
|
+
});
|
|
142
|
+
return response.body;
|
|
143
|
+
}
|
|
144
|
+
async configureVideo(options) {
|
|
145
|
+
return this.configure({
|
|
146
|
+
...options,
|
|
147
|
+
video_result: 'deprecated',
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
async configurePhoto(options) {
|
|
151
|
+
return this.configure({
|
|
152
|
+
...options,
|
|
153
|
+
source_type: '4',
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
async configureToStory(options) {
|
|
157
|
+
return this.configure({
|
|
158
|
+
...options,
|
|
159
|
+
configure_mode: 1,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
async configureToClips(options) {
|
|
163
|
+
const data = {
|
|
164
|
+
upload_id: options.uploadId,
|
|
165
|
+
source_type: '4',
|
|
166
|
+
_uid: this.client.state.cookieUserId,
|
|
167
|
+
_uuid: this.client.state.uuid,
|
|
168
|
+
caption: options.caption || '',
|
|
169
|
+
clips_share_preview_to_feed: options.shareToFeed ? '1' : '0',
|
|
170
|
+
device: {
|
|
171
|
+
manufacturer: 'samsung',
|
|
172
|
+
model: 'SM-S928B',
|
|
173
|
+
android_version: 35,
|
|
174
|
+
android_release: '15',
|
|
175
|
+
},
|
|
176
|
+
length: options.length || 0,
|
|
177
|
+
poster_frame_index: '0',
|
|
178
|
+
audio_muted: '0',
|
|
179
|
+
filter_type: '0',
|
|
180
|
+
video_result: '',
|
|
181
|
+
clips_creation_entry_point: 'clips',
|
|
182
|
+
};
|
|
183
|
+
const response = await this.client.request.send({
|
|
184
|
+
url: '/api/v1/media/configure_to_clips/',
|
|
185
|
+
method: 'POST',
|
|
186
|
+
form: this.client.request.sign(data),
|
|
187
|
+
});
|
|
188
|
+
return response.body;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
module.exports = UploadRepository;
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
const Repository = require('../core/repository');
|
|
2
|
+
const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
|
|
3
|
+
class UserRepository extends Repository {
|
|
4
|
+
constructor(client) {
|
|
5
|
+
super(client);
|
|
6
|
+
this._usersCache = {};
|
|
7
|
+
this._usernamesCache = {};
|
|
8
|
+
}
|
|
9
|
+
async infoByUsername(username) {
|
|
10
|
+
const response = await this.client.request.send({
|
|
11
|
+
method: 'GET',
|
|
12
|
+
url: `/api/v1/users/${username}/usernameinfo/`,
|
|
13
|
+
});
|
|
14
|
+
return response.body.user;
|
|
15
|
+
}
|
|
16
|
+
async info(userId) {
|
|
17
|
+
const response = await this.client.request.send({
|
|
18
|
+
method: 'GET',
|
|
19
|
+
url: `/api/v1/users/${userId}/info/`,
|
|
20
|
+
});
|
|
21
|
+
return response.body.user;
|
|
22
|
+
}
|
|
23
|
+
async infoV1(userId, fromModule = 'self_profile') {
|
|
24
|
+
const response = await this.client.request.send({
|
|
25
|
+
method: 'GET',
|
|
26
|
+
url: `/api/v1/users/${userId}/info/`,
|
|
27
|
+
qs: { from_module: fromModule },
|
|
28
|
+
});
|
|
29
|
+
return response.body.user;
|
|
30
|
+
}
|
|
31
|
+
async userIdFromUsername(username) {
|
|
32
|
+
const user = await this.infoByUsername(username.toLowerCase());
|
|
33
|
+
return String(user.pk);
|
|
34
|
+
}
|
|
35
|
+
async usernameFromUserId(userId) {
|
|
36
|
+
const user = await this.info(userId);
|
|
37
|
+
return user.username;
|
|
38
|
+
}
|
|
39
|
+
async search(query, count = 50) {
|
|
40
|
+
const response = await this.client.request.send({
|
|
41
|
+
method: 'GET',
|
|
42
|
+
url: '/api/v1/users/search/',
|
|
43
|
+
qs: { q: query, count },
|
|
44
|
+
});
|
|
45
|
+
return response.body.users;
|
|
46
|
+
}
|
|
47
|
+
async searchExact(username) {
|
|
48
|
+
const response = await this.client.request.send({
|
|
49
|
+
method: 'GET',
|
|
50
|
+
url: '/api/v1/users/search/',
|
|
51
|
+
qs: {
|
|
52
|
+
q: username,
|
|
53
|
+
count: 1,
|
|
54
|
+
search_surface: 'user_search_page',
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
const users = response.body.users || [];
|
|
58
|
+
return users.find(u => u.username === username) || null;
|
|
59
|
+
}
|
|
60
|
+
async follow(userId) {
|
|
61
|
+
const response = await this.client.request.send({
|
|
62
|
+
method: 'POST',
|
|
63
|
+
url: `/api/v1/friendships/create/${userId}/`,
|
|
64
|
+
form: this.client.request.sign({
|
|
65
|
+
_uid: this.client.state.cookieUserId,
|
|
66
|
+
_uuid: this.client.state.uuid,
|
|
67
|
+
user_id: userId,
|
|
68
|
+
}),
|
|
69
|
+
});
|
|
70
|
+
return response.body;
|
|
71
|
+
}
|
|
72
|
+
async unfollow(userId) {
|
|
73
|
+
const response = await this.client.request.send({
|
|
74
|
+
method: 'POST',
|
|
75
|
+
url: `/api/v1/friendships/destroy/${userId}/`,
|
|
76
|
+
form: this.client.request.sign({
|
|
77
|
+
_uid: this.client.state.cookieUserId,
|
|
78
|
+
_uuid: this.client.state.uuid,
|
|
79
|
+
user_id: userId,
|
|
80
|
+
}),
|
|
81
|
+
});
|
|
82
|
+
return response.body;
|
|
83
|
+
}
|
|
84
|
+
async getFollowers(userId, amount = 200, maxId = null) {
|
|
85
|
+
return this._paginateUsers(`/api/v1/friendships/${userId}/followers/`, amount, maxId);
|
|
86
|
+
}
|
|
87
|
+
async getFollowing(userId, amount = 200, maxId = null) {
|
|
88
|
+
return this._paginateUsers(`/api/v1/friendships/${userId}/following/`, amount, maxId);
|
|
89
|
+
}
|
|
90
|
+
async _paginateUsers(endpoint, amount = 200, startMaxId = null) {
|
|
91
|
+
const allUsers = [];
|
|
92
|
+
let nextMaxId = startMaxId;
|
|
93
|
+
while (allUsers.length < amount) {
|
|
94
|
+
const qs = {};
|
|
95
|
+
if (nextMaxId)
|
|
96
|
+
qs.max_id = nextMaxId;
|
|
97
|
+
const response = await this.client.request.send({
|
|
98
|
+
method: 'GET',
|
|
99
|
+
url: endpoint,
|
|
100
|
+
qs,
|
|
101
|
+
});
|
|
102
|
+
const body = response.body;
|
|
103
|
+
const users = body.users || [];
|
|
104
|
+
allUsers.push(...users);
|
|
105
|
+
if (!body.next_max_id)
|
|
106
|
+
break;
|
|
107
|
+
nextMaxId = body.next_max_id;
|
|
108
|
+
}
|
|
109
|
+
return { users: allUsers.slice(0, amount), nextMaxId };
|
|
110
|
+
}
|
|
111
|
+
async getFriendshipStatuses(userIds) {
|
|
112
|
+
const response = await this.client.request.send({
|
|
113
|
+
method: 'POST',
|
|
114
|
+
url: '/api/v1/friendships/show_many/',
|
|
115
|
+
form: this.client.request.sign({
|
|
116
|
+
user_ids: Array.isArray(userIds) ? userIds.join(',') : userIds,
|
|
117
|
+
_uuid: this.client.state.uuid,
|
|
118
|
+
}),
|
|
119
|
+
});
|
|
120
|
+
return response.body;
|
|
121
|
+
}
|
|
122
|
+
async friendshipShow(userId) {
|
|
123
|
+
const response = await this.client.request.send({
|
|
124
|
+
method: 'GET',
|
|
125
|
+
url: `/api/v1/friendships/show/${userId}/`,
|
|
126
|
+
});
|
|
127
|
+
return response.body;
|
|
128
|
+
}
|
|
129
|
+
async getReelsTrayFeed() {
|
|
130
|
+
const response = await this.client.request.send({
|
|
131
|
+
method: 'GET',
|
|
132
|
+
url: '/api/v1/feed/reels_tray/',
|
|
133
|
+
});
|
|
134
|
+
return response.body;
|
|
135
|
+
}
|
|
136
|
+
async getUserTags(userId, maxId = null) {
|
|
137
|
+
const qs = {};
|
|
138
|
+
if (maxId)
|
|
139
|
+
qs.max_id = maxId;
|
|
140
|
+
const response = await this.client.request.send({
|
|
141
|
+
method: 'GET',
|
|
142
|
+
url: `/api/v1/usertags/${userId}/feed/`,
|
|
143
|
+
qs,
|
|
144
|
+
});
|
|
145
|
+
return response.body;
|
|
146
|
+
}
|
|
147
|
+
async getUserMedias(userId, amount = 50, maxId = null) {
|
|
148
|
+
const allItems = [];
|
|
149
|
+
let nextMaxId = maxId;
|
|
150
|
+
while (allItems.length < amount) {
|
|
151
|
+
const qs = { count: Math.min(amount - allItems.length, 33) };
|
|
152
|
+
if (nextMaxId)
|
|
153
|
+
qs.max_id = nextMaxId;
|
|
154
|
+
const response = await this.client.request.send({
|
|
155
|
+
method: 'GET',
|
|
156
|
+
url: `/api/v1/feed/user/${userId}/`,
|
|
157
|
+
qs,
|
|
158
|
+
});
|
|
159
|
+
const body = response.body;
|
|
160
|
+
allItems.push(...(body.items || []));
|
|
161
|
+
if (!body.more_available || !body.next_max_id)
|
|
162
|
+
break;
|
|
163
|
+
nextMaxId = body.next_max_id;
|
|
164
|
+
}
|
|
165
|
+
return allItems.slice(0, amount);
|
|
166
|
+
}
|
|
167
|
+
async getUserReels(userId, amount = 50, maxId = null) {
|
|
168
|
+
const allItems = [];
|
|
169
|
+
let nextMaxId = maxId;
|
|
170
|
+
while (allItems.length < amount) {
|
|
171
|
+
const response = await this.client.request.send({
|
|
172
|
+
method: 'POST',
|
|
173
|
+
url: '/api/v1/clips/user/',
|
|
174
|
+
form: {
|
|
175
|
+
target_user_id: userId,
|
|
176
|
+
page_size: Math.min(amount - allItems.length, 12),
|
|
177
|
+
max_id: nextMaxId || '',
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
const body = response.body;
|
|
181
|
+
for (const item of (body.items || [])) {
|
|
182
|
+
allItems.push(item.media || item);
|
|
183
|
+
}
|
|
184
|
+
const pagingInfo = body.paging_info || {};
|
|
185
|
+
if (!pagingInfo.more_available)
|
|
186
|
+
break;
|
|
187
|
+
nextMaxId = pagingInfo.max_id || '';
|
|
188
|
+
}
|
|
189
|
+
return allItems.slice(0, amount);
|
|
190
|
+
}
|
|
191
|
+
async getUserClips(userId, amount = 50, maxId = null) {
|
|
192
|
+
return this.getUserReels(userId, amount, maxId);
|
|
193
|
+
}
|
|
194
|
+
async getUserStories(userId) {
|
|
195
|
+
const response = await this.client.request.send({
|
|
196
|
+
method: 'POST',
|
|
197
|
+
url: `/api/v1/feed/user/${userId}/story/`,
|
|
198
|
+
form: {
|
|
199
|
+
supported_capabilities_new: JSON.stringify(this.client.state.constants.SUPPORTED_CAPABILITIES),
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
return response.body;
|
|
203
|
+
}
|
|
204
|
+
async setSelfBio(biography) {
|
|
205
|
+
const response = await this.client.request.send({
|
|
206
|
+
method: 'POST',
|
|
207
|
+
url: '/api/v1/accounts/set_biography/',
|
|
208
|
+
form: this.client.request.sign({
|
|
209
|
+
_uid: this.client.state.cookieUserId,
|
|
210
|
+
_uuid: this.client.state.uuid,
|
|
211
|
+
raw_text: biography,
|
|
212
|
+
}),
|
|
213
|
+
});
|
|
214
|
+
return response.body;
|
|
215
|
+
}
|
|
216
|
+
async report(userId, reason = 1) {
|
|
217
|
+
const response = await this.client.request.send({
|
|
218
|
+
method: 'POST',
|
|
219
|
+
url: `/api/v1/users/${userId}/flag_user/`,
|
|
220
|
+
form: this.client.request.sign({
|
|
221
|
+
reason_id: reason,
|
|
222
|
+
_uid: this.client.state.cookieUserId,
|
|
223
|
+
_uuid: this.client.state.uuid,
|
|
224
|
+
}),
|
|
225
|
+
});
|
|
226
|
+
return response.body;
|
|
227
|
+
}
|
|
228
|
+
async getSuggested() {
|
|
229
|
+
const response = await this.client.request.send({
|
|
230
|
+
method: 'GET',
|
|
231
|
+
url: '/api/v1/discover/ayml/',
|
|
232
|
+
});
|
|
233
|
+
return response.body;
|
|
234
|
+
}
|
|
235
|
+
async block(userId) {
|
|
236
|
+
const response = await this.client.request.send({
|
|
237
|
+
method: 'POST',
|
|
238
|
+
url: `/api/v1/friendships/block/${userId}/`,
|
|
239
|
+
form: this.client.request.sign({
|
|
240
|
+
_uid: this.client.state.cookieUserId,
|
|
241
|
+
_uuid: this.client.state.uuid,
|
|
242
|
+
user_id: userId,
|
|
243
|
+
}),
|
|
244
|
+
});
|
|
245
|
+
return response.body;
|
|
246
|
+
}
|
|
247
|
+
async unblock(userId) {
|
|
248
|
+
const response = await this.client.request.send({
|
|
249
|
+
method: 'POST',
|
|
250
|
+
url: `/api/v1/friendships/unblock/${userId}/`,
|
|
251
|
+
form: this.client.request.sign({
|
|
252
|
+
_uid: this.client.state.cookieUserId,
|
|
253
|
+
_uuid: this.client.state.uuid,
|
|
254
|
+
user_id: userId,
|
|
255
|
+
}),
|
|
256
|
+
});
|
|
257
|
+
return response.body;
|
|
258
|
+
}
|
|
259
|
+
async mute(userId, { muteStories = false, mutePosts = false } = {}) {
|
|
260
|
+
const response = await this.client.request.send({
|
|
261
|
+
method: 'POST',
|
|
262
|
+
url: `/api/v1/friendships/mute_posts_or_story_from_follow/`,
|
|
263
|
+
form: this.client.request.sign({
|
|
264
|
+
_uid: this.client.state.cookieUserId,
|
|
265
|
+
_uuid: this.client.state.uuid,
|
|
266
|
+
target_posts_author_id: mutePosts ? userId : '',
|
|
267
|
+
target_reel_author_id: muteStories ? userId : '',
|
|
268
|
+
}),
|
|
269
|
+
});
|
|
270
|
+
return response.body;
|
|
271
|
+
}
|
|
272
|
+
async unmute(userId, { unmuteStories = false, unmutePosts = false } = {}) {
|
|
273
|
+
const response = await this.client.request.send({
|
|
274
|
+
method: 'POST',
|
|
275
|
+
url: `/api/v1/friendships/unmute_posts_or_story_from_follow/`,
|
|
276
|
+
form: this.client.request.sign({
|
|
277
|
+
_uid: this.client.state.cookieUserId,
|
|
278
|
+
_uuid: this.client.state.uuid,
|
|
279
|
+
target_posts_author_id: unmutePosts ? userId : '',
|
|
280
|
+
target_reel_author_id: unmuteStories ? userId : '',
|
|
281
|
+
}),
|
|
282
|
+
});
|
|
283
|
+
return response.body;
|
|
284
|
+
}
|
|
285
|
+
async removeFollower(userId) {
|
|
286
|
+
const response = await this.client.request.send({
|
|
287
|
+
method: 'POST',
|
|
288
|
+
url: `/api/v1/friendships/remove_follower/${userId}/`,
|
|
289
|
+
form: this.client.request.sign({
|
|
290
|
+
_uid: this.client.state.cookieUserId,
|
|
291
|
+
_uuid: this.client.state.uuid,
|
|
292
|
+
user_id: userId,
|
|
293
|
+
}),
|
|
294
|
+
});
|
|
295
|
+
return response.body;
|
|
296
|
+
}
|
|
297
|
+
async getBlockedUsers() {
|
|
298
|
+
const response = await this.client.request.send({
|
|
299
|
+
method: 'GET',
|
|
300
|
+
url: '/api/v1/users/blocked_list/',
|
|
301
|
+
});
|
|
302
|
+
return response.body;
|
|
303
|
+
}
|
|
304
|
+
async getMutualFollowers(userId) {
|
|
305
|
+
const response = await this.client.request.send({
|
|
306
|
+
method: 'GET',
|
|
307
|
+
url: `/api/v1/friendships/${userId}/mutual_followers/`,
|
|
308
|
+
});
|
|
309
|
+
return response.body;
|
|
310
|
+
}
|
|
311
|
+
static mediaPkFromCode(code) {
|
|
312
|
+
let pk = BigInt(0);
|
|
313
|
+
for (let i = 0; i < code.length; i++) {
|
|
314
|
+
const idx = ALPHABET.indexOf(code[i]);
|
|
315
|
+
if (idx === -1)
|
|
316
|
+
continue;
|
|
317
|
+
pk = pk * BigInt(64) + BigInt(idx);
|
|
318
|
+
}
|
|
319
|
+
return pk.toString();
|
|
320
|
+
}
|
|
321
|
+
static mediaCodeFromPk(pk) {
|
|
322
|
+
let id = BigInt(pk);
|
|
323
|
+
let code = '';
|
|
324
|
+
while (id > BigInt(0)) {
|
|
325
|
+
const remainder = Number(id % BigInt(64));
|
|
326
|
+
code = ALPHABET[remainder] + code;
|
|
327
|
+
id = id / BigInt(64);
|
|
328
|
+
}
|
|
329
|
+
return code;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
module.exports = UserRepository;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const sendPhoto = require('./sendPhoto');
|
|
2
|
+
const sendFile = require('./sendFile');
|
|
3
|
+
const uploadPhoto = require('./uploadPhoto');
|
|
4
|
+
const uploadFile = require('./uploadfFile');
|
|
5
|
+
const sendRavenPhotoModule = require('./sendRavenPhoto');
|
|
6
|
+
const sendRavenVideoModule = require('./sendRavenVideo');
|
|
7
|
+
const sendRavenPhoto = sendRavenPhotoModule.sendRavenPhoto || sendRavenPhotoModule;
|
|
8
|
+
const sendRavenPhotoOnce = sendRavenPhotoModule.sendRavenPhotoOnce;
|
|
9
|
+
const sendRavenPhotoReplayable = sendRavenPhotoModule.sendRavenPhotoReplayable;
|
|
10
|
+
const sendRavenVideo = sendRavenVideoModule.sendRavenVideo || sendRavenVideoModule;
|
|
11
|
+
const sendRavenVideoOnce = sendRavenVideoModule.sendRavenVideoOnce;
|
|
12
|
+
const sendRavenVideoReplayable = sendRavenVideoModule.sendRavenVideoReplayable;
|
|
13
|
+
module.exports = {
|
|
14
|
+
sendPhoto,
|
|
15
|
+
sendFile,
|
|
16
|
+
uploadPhoto,
|
|
17
|
+
uploadFile,
|
|
18
|
+
sendRavenPhoto,
|
|
19
|
+
sendRavenPhotoOnce,
|
|
20
|
+
sendRavenPhotoReplayable,
|
|
21
|
+
sendRavenVideo,
|
|
22
|
+
sendRavenVideoOnce,
|
|
23
|
+
sendRavenVideoReplayable,
|
|
24
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sendFile.js - Fixed to support MQTT if realtime client provided
|
|
3
|
+
*/
|
|
4
|
+
const uploadFile = require('./uploadfFile');
|
|
5
|
+
/**
|
|
6
|
+
* Send a file to Instagram Direct.
|
|
7
|
+
*/
|
|
8
|
+
async function sendFile(session, opts = {}) {
|
|
9
|
+
const { fileBuffer, mimeType = 'video/mp4', fileName, caption = '', userId, threadId, signal, realtimeClient, } = opts;
|
|
10
|
+
if (!userId && !threadId) {
|
|
11
|
+
throw new Error('sendFile: Provide userId or threadId.');
|
|
12
|
+
}
|
|
13
|
+
if (!fileBuffer || !Buffer.isBuffer(fileBuffer) || fileBuffer.length === 0) {
|
|
14
|
+
throw new Error('sendFile: fileBuffer must be a non-empty Buffer.');
|
|
15
|
+
}
|
|
16
|
+
// 1) Upload
|
|
17
|
+
const upload_id = await uploadFile(session, fileBuffer, {
|
|
18
|
+
mimeType,
|
|
19
|
+
fileName,
|
|
20
|
+
signal,
|
|
21
|
+
});
|
|
22
|
+
// 2) MQTT Check
|
|
23
|
+
if (realtimeClient && realtimeClient.direct && typeof realtimeClient.direct.sendMedia === 'function') {
|
|
24
|
+
return await realtimeClient.direct.sendMedia({
|
|
25
|
+
text: caption,
|
|
26
|
+
mediaId: upload_id,
|
|
27
|
+
threadId: threadId || userId,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
// 3) REST Fallback
|
|
31
|
+
const url = '/direct_v2/threads/broadcast/upload_video/';
|
|
32
|
+
const form = {
|
|
33
|
+
upload_id,
|
|
34
|
+
action: 'send_item',
|
|
35
|
+
caption,
|
|
36
|
+
};
|
|
37
|
+
if (userId) {
|
|
38
|
+
form.recipient_users = JSON.stringify([[String(userId)]]);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
form.thread_ids = JSON.stringify([String(threadId)]);
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const response = await session.request.send({
|
|
45
|
+
url,
|
|
46
|
+
method: 'POST',
|
|
47
|
+
form,
|
|
48
|
+
signal,
|
|
49
|
+
});
|
|
50
|
+
return response;
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
throw new Error(`sendFile: Broadcast failed — ${err.message}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
module.exports = sendFile;
|