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,178 @@
|
|
|
1
|
+
const Repository = require('../core/repository');
|
|
2
|
+
class SignupRepository extends Repository {
|
|
3
|
+
constructor(client) {
|
|
4
|
+
super(client);
|
|
5
|
+
this.waterfallId = this._generateUUID();
|
|
6
|
+
}
|
|
7
|
+
_generateUUID() {
|
|
8
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
9
|
+
const r = Math.random() * 16 | 0;
|
|
10
|
+
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
async signup(options = {}) {
|
|
14
|
+
const { username, password, email, phoneNumber = '', fullName = '', year = null, month = null, day = null, } = options;
|
|
15
|
+
await this.getSignupConfig();
|
|
16
|
+
const checkResult = await this.checkEmail(email);
|
|
17
|
+
if (!checkResult.valid) {
|
|
18
|
+
throw new Error(`Email not valid: ${checkResult.error_title || JSON.stringify(checkResult)}`);
|
|
19
|
+
}
|
|
20
|
+
if (!checkResult.available) {
|
|
21
|
+
throw new Error(`Email not available: ${checkResult.feedback_message || JSON.stringify(checkResult)}`);
|
|
22
|
+
}
|
|
23
|
+
const sendResult = await this.sendVerifyEmail(email);
|
|
24
|
+
if (!sendResult.email_sent) {
|
|
25
|
+
throw new Error(`Failed to send verification email: ${JSON.stringify(sendResult)}`);
|
|
26
|
+
}
|
|
27
|
+
if (year && month && day) {
|
|
28
|
+
const ageCheck = await this.checkAgeEligibility(year, month, day);
|
|
29
|
+
if (!ageCheck.eligible) {
|
|
30
|
+
throw new Error(`Not eligible based on age: ${JSON.stringify(ageCheck)}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return { status: 'verification_sent', email };
|
|
34
|
+
}
|
|
35
|
+
async getSignupConfig() {
|
|
36
|
+
const response = await this.client.request.send({
|
|
37
|
+
method: 'GET',
|
|
38
|
+
url: '/api/v1/consent/get_signup_config/',
|
|
39
|
+
qs: {
|
|
40
|
+
guid: this.client.state.uuid,
|
|
41
|
+
main_account_selected: false,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
return response.body;
|
|
45
|
+
}
|
|
46
|
+
async checkEmail(email) {
|
|
47
|
+
const response = await this.client.request.send({
|
|
48
|
+
method: 'POST',
|
|
49
|
+
url: '/api/v1/users/check_email/',
|
|
50
|
+
form: {
|
|
51
|
+
android_device_id: this.client.state.deviceId,
|
|
52
|
+
login_nonce_map: '{}',
|
|
53
|
+
login_nonces: '[]',
|
|
54
|
+
email,
|
|
55
|
+
qe_id: this._generateUUID(),
|
|
56
|
+
waterfall_id: this.waterfallId,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
return response.body;
|
|
60
|
+
}
|
|
61
|
+
async checkUsername(username) {
|
|
62
|
+
const response = await this.client.request.send({
|
|
63
|
+
method: 'POST',
|
|
64
|
+
url: '/api/v1/users/check_username/',
|
|
65
|
+
form: {
|
|
66
|
+
username,
|
|
67
|
+
_uuid: this.client.state.uuid,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
return response.body;
|
|
71
|
+
}
|
|
72
|
+
async sendVerifyEmail(email) {
|
|
73
|
+
const response = await this.client.request.send({
|
|
74
|
+
method: 'POST',
|
|
75
|
+
url: '/api/v1/accounts/send_verify_email/',
|
|
76
|
+
form: {
|
|
77
|
+
phone_id: this.client.state.phoneId,
|
|
78
|
+
device_id: this.client.state.deviceId,
|
|
79
|
+
email,
|
|
80
|
+
waterfall_id: this.waterfallId,
|
|
81
|
+
auto_confirm_only: 'false',
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
return response.body;
|
|
85
|
+
}
|
|
86
|
+
async checkConfirmationCode(email, code) {
|
|
87
|
+
const response = await this.client.request.send({
|
|
88
|
+
method: 'POST',
|
|
89
|
+
url: '/api/v1/accounts/check_confirmation_code/',
|
|
90
|
+
form: {
|
|
91
|
+
code,
|
|
92
|
+
device_id: this.client.state.deviceId,
|
|
93
|
+
email,
|
|
94
|
+
waterfall_id: this.waterfallId,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
return response.body;
|
|
98
|
+
}
|
|
99
|
+
async checkAgeEligibility(year, month, day) {
|
|
100
|
+
const response = await this.client.request.send({
|
|
101
|
+
method: 'POST',
|
|
102
|
+
url: '/api/v1/consent/check_age_eligibility/',
|
|
103
|
+
form: {
|
|
104
|
+
_uuid: this.client.state.uuid,
|
|
105
|
+
day: String(day),
|
|
106
|
+
month: String(month),
|
|
107
|
+
year: String(year),
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
return response.body;
|
|
111
|
+
}
|
|
112
|
+
async accountsCreate(options = {}) {
|
|
113
|
+
const { username, password, email, signupCode, fullName = '', year = null, month = null, day = null, } = options;
|
|
114
|
+
const { encrypted, time } = this.client.account.encryptPassword(password);
|
|
115
|
+
const data = {
|
|
116
|
+
enc_password: `#PWD_INSTAGRAM:4:${time}:${encrypted}`,
|
|
117
|
+
phone_id: this.client.state.phoneId,
|
|
118
|
+
username,
|
|
119
|
+
first_name: fullName,
|
|
120
|
+
day: day ? String(day) : '',
|
|
121
|
+
month: month ? String(month) : '',
|
|
122
|
+
year: year ? String(year) : '',
|
|
123
|
+
device_id: this.client.state.deviceId,
|
|
124
|
+
email,
|
|
125
|
+
signup_code: signupCode || '',
|
|
126
|
+
waterfall_id: this.waterfallId,
|
|
127
|
+
_uuid: this.client.state.uuid,
|
|
128
|
+
force_sign_up_code: '',
|
|
129
|
+
qs_stamp: '',
|
|
130
|
+
has_sms_consent: 'true',
|
|
131
|
+
};
|
|
132
|
+
const response = await this.client.request.send({
|
|
133
|
+
method: 'POST',
|
|
134
|
+
url: '/api/v1/accounts/create/',
|
|
135
|
+
form: this.client.request.sign(data),
|
|
136
|
+
});
|
|
137
|
+
return response.body;
|
|
138
|
+
}
|
|
139
|
+
async sendSignupSmsCode(phoneNumber) {
|
|
140
|
+
const response = await this.client.request.send({
|
|
141
|
+
method: 'POST',
|
|
142
|
+
url: '/api/v1/accounts/send_signup_sms_code/',
|
|
143
|
+
form: this.client.request.sign({
|
|
144
|
+
phone_id: this.client.state.phoneId,
|
|
145
|
+
phone_number: phoneNumber,
|
|
146
|
+
waterfall_id: this.waterfallId,
|
|
147
|
+
has_whatsapp_installed: '0',
|
|
148
|
+
}),
|
|
149
|
+
});
|
|
150
|
+
return response.body;
|
|
151
|
+
}
|
|
152
|
+
async validateSignupSmsCode(phoneNumber, code) {
|
|
153
|
+
const response = await this.client.request.send({
|
|
154
|
+
method: 'POST',
|
|
155
|
+
url: '/api/v1/accounts/validate_signup_sms_code/',
|
|
156
|
+
form: this.client.request.sign({
|
|
157
|
+
phone_id: this.client.state.phoneId,
|
|
158
|
+
phone_number: phoneNumber,
|
|
159
|
+
verification_code: code,
|
|
160
|
+
waterfall_id: this.waterfallId,
|
|
161
|
+
}),
|
|
162
|
+
});
|
|
163
|
+
return response.body;
|
|
164
|
+
}
|
|
165
|
+
async getSuggestedUsernames(name, email) {
|
|
166
|
+
const response = await this.client.request.send({
|
|
167
|
+
method: 'POST',
|
|
168
|
+
url: '/api/v1/accounts/username_suggestions/',
|
|
169
|
+
form: {
|
|
170
|
+
name: name || '',
|
|
171
|
+
email: email || '',
|
|
172
|
+
waterfall_id: this.waterfallId,
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
return response.body;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
module.exports = SignupRepository;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
const Repository = require('../core/repository');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
class StoryRepository extends Repository {
|
|
4
|
+
async react(options) {
|
|
5
|
+
const { storyId, reaction } = options;
|
|
6
|
+
const response = await this.client.request.send({
|
|
7
|
+
url: `/api/v1/media/${storyId}/story_react/`,
|
|
8
|
+
method: 'POST',
|
|
9
|
+
form: this.client.request.sign({
|
|
10
|
+
_uid: this.client.state.cookieUserId,
|
|
11
|
+
_uuid: this.client.state.uuid,
|
|
12
|
+
reaction_type: 'like',
|
|
13
|
+
emoji: reaction || '\u2764\uFE0F',
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
return response.body;
|
|
17
|
+
}
|
|
18
|
+
async getFeed() {
|
|
19
|
+
const response = await this.client.request.send({
|
|
20
|
+
method: 'POST',
|
|
21
|
+
url: '/api/v1/feed/reels_tray/',
|
|
22
|
+
form: this.client.request.sign({
|
|
23
|
+
supported_capabilities_new: JSON.stringify(this.client.state.constants.SUPPORTED_CAPABILITIES),
|
|
24
|
+
reason: 'pull_to_refresh',
|
|
25
|
+
_uuid: this.client.state.uuid,
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
return response.body;
|
|
29
|
+
}
|
|
30
|
+
async getUser(userId) {
|
|
31
|
+
const response = await this.client.request.send({
|
|
32
|
+
method: 'GET',
|
|
33
|
+
url: `/api/v1/feed/user/${userId}/reel_media/`,
|
|
34
|
+
});
|
|
35
|
+
return response.body;
|
|
36
|
+
}
|
|
37
|
+
async getUserStories(userId) {
|
|
38
|
+
return this.getUser(userId);
|
|
39
|
+
}
|
|
40
|
+
async upload(options) {
|
|
41
|
+
const { imagePath, caption, mentions, links, hashtags, stickers } = options;
|
|
42
|
+
const imageBuffer = fs.readFileSync(imagePath);
|
|
43
|
+
const uploadId = Date.now();
|
|
44
|
+
const uploadResult = await this.client.upload.photo({
|
|
45
|
+
file: imageBuffer,
|
|
46
|
+
uploadId,
|
|
47
|
+
});
|
|
48
|
+
return this.configureStory({
|
|
49
|
+
uploadId: uploadResult.upload_id,
|
|
50
|
+
caption,
|
|
51
|
+
mentions,
|
|
52
|
+
links,
|
|
53
|
+
hashtags,
|
|
54
|
+
stickers,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async uploadVideo(options) {
|
|
58
|
+
const { videoPath, caption, mentions, links, hashtags, stickers } = options;
|
|
59
|
+
const videoBuffer = fs.readFileSync(videoPath);
|
|
60
|
+
const uploadId = Date.now();
|
|
61
|
+
const uploadResult = await this.client.upload.video({
|
|
62
|
+
video: videoBuffer,
|
|
63
|
+
uploadId,
|
|
64
|
+
duration_ms: options.duration_ms || 15000,
|
|
65
|
+
width: options.width || 720,
|
|
66
|
+
height: options.height || 1280,
|
|
67
|
+
});
|
|
68
|
+
return this.configureStoryVideo({
|
|
69
|
+
uploadId: uploadResult.upload_id,
|
|
70
|
+
caption,
|
|
71
|
+
mentions,
|
|
72
|
+
links,
|
|
73
|
+
hashtags,
|
|
74
|
+
stickers,
|
|
75
|
+
length: options.duration_ms || 15000,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
async configureStory(options = {}) {
|
|
79
|
+
const { uploadId, caption, mentions, links, hashtags, stickers } = options;
|
|
80
|
+
const data = {
|
|
81
|
+
upload_id: uploadId,
|
|
82
|
+
source_type: '4',
|
|
83
|
+
configure_mode: '1',
|
|
84
|
+
caption: caption || '',
|
|
85
|
+
_uid: this.client.state.cookieUserId,
|
|
86
|
+
_uuid: this.client.state.uuid,
|
|
87
|
+
};
|
|
88
|
+
if (mentions && mentions.length > 0) {
|
|
89
|
+
data.reel_mentions = JSON.stringify(mentions);
|
|
90
|
+
}
|
|
91
|
+
if (links && links.length > 0) {
|
|
92
|
+
data.story_cta = JSON.stringify(links.map(l => ({
|
|
93
|
+
links: [{ webUri: l.url || l, linkType: 1 }],
|
|
94
|
+
})));
|
|
95
|
+
}
|
|
96
|
+
if (hashtags && hashtags.length > 0) {
|
|
97
|
+
data.story_hashtags = JSON.stringify(hashtags);
|
|
98
|
+
}
|
|
99
|
+
if (stickers && stickers.length > 0) {
|
|
100
|
+
data.story_sticker_ids = JSON.stringify(stickers.map(s => s.id || s));
|
|
101
|
+
}
|
|
102
|
+
const response = await this.client.request.send({
|
|
103
|
+
url: '/api/v1/media/configure_to_story/',
|
|
104
|
+
method: 'POST',
|
|
105
|
+
form: this.client.request.sign(data),
|
|
106
|
+
});
|
|
107
|
+
return response.body;
|
|
108
|
+
}
|
|
109
|
+
async configureStoryVideo(options = {}) {
|
|
110
|
+
const { uploadId, caption, mentions, links, hashtags, stickers, length } = options;
|
|
111
|
+
const data = {
|
|
112
|
+
upload_id: uploadId,
|
|
113
|
+
source_type: '4',
|
|
114
|
+
configure_mode: '1',
|
|
115
|
+
caption: caption || '',
|
|
116
|
+
_uid: this.client.state.cookieUserId,
|
|
117
|
+
_uuid: this.client.state.uuid,
|
|
118
|
+
video_result: 'deprecated',
|
|
119
|
+
length: length || 0,
|
|
120
|
+
clips: JSON.stringify([{ length: length || 0, source_type: '4' }]),
|
|
121
|
+
poster_frame_index: '0',
|
|
122
|
+
audio_muted: '0',
|
|
123
|
+
};
|
|
124
|
+
if (mentions && mentions.length > 0) {
|
|
125
|
+
data.reel_mentions = JSON.stringify(mentions);
|
|
126
|
+
}
|
|
127
|
+
if (links && links.length > 0) {
|
|
128
|
+
data.story_cta = JSON.stringify(links.map(l => ({
|
|
129
|
+
links: [{ webUri: l.url || l, linkType: 1 }],
|
|
130
|
+
})));
|
|
131
|
+
}
|
|
132
|
+
if (hashtags && hashtags.length > 0) {
|
|
133
|
+
data.story_hashtags = JSON.stringify(hashtags);
|
|
134
|
+
}
|
|
135
|
+
if (stickers && stickers.length > 0) {
|
|
136
|
+
data.story_sticker_ids = JSON.stringify(stickers.map(s => s.id || s));
|
|
137
|
+
}
|
|
138
|
+
const response = await this.client.request.send({
|
|
139
|
+
url: '/api/v1/media/configure_to_story/',
|
|
140
|
+
method: 'POST',
|
|
141
|
+
form: this.client.request.sign(data),
|
|
142
|
+
});
|
|
143
|
+
return response.body;
|
|
144
|
+
}
|
|
145
|
+
async seen(input, sourceId = null) {
|
|
146
|
+
let items = [];
|
|
147
|
+
if (Array.isArray(input)) {
|
|
148
|
+
items = input;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
items = Object.values(input).reduce((acc, reel) => acc.concat(reel.items || []), []);
|
|
152
|
+
}
|
|
153
|
+
const reels = {};
|
|
154
|
+
const maxSeenAt = Math.floor(Date.now() / 1000);
|
|
155
|
+
let seenAt = maxSeenAt - items.length;
|
|
156
|
+
for (const item of items) {
|
|
157
|
+
const itemTakenAt = item.taken_at;
|
|
158
|
+
if (seenAt < itemTakenAt)
|
|
159
|
+
seenAt = itemTakenAt + 1;
|
|
160
|
+
if (seenAt > maxSeenAt)
|
|
161
|
+
seenAt = maxSeenAt;
|
|
162
|
+
const itemSourceId = sourceId === null ? item.user.pk : sourceId;
|
|
163
|
+
const reelId = `${item.id}_${itemSourceId}`;
|
|
164
|
+
reels[reelId] = [`${itemTakenAt}_${seenAt}`];
|
|
165
|
+
seenAt += 1;
|
|
166
|
+
}
|
|
167
|
+
return this.client.media.seen(reels);
|
|
168
|
+
}
|
|
169
|
+
async getHighlights(userId) {
|
|
170
|
+
const response = await this.client.request.send({
|
|
171
|
+
method: 'GET',
|
|
172
|
+
url: `/api/v1/highlights/${userId}/highlights_tray/`,
|
|
173
|
+
});
|
|
174
|
+
return response.body;
|
|
175
|
+
}
|
|
176
|
+
async getHighlight(highlightId) {
|
|
177
|
+
const ids = Array.isArray(highlightId) ? highlightId : [highlightId];
|
|
178
|
+
const response = await this.client.request.send({
|
|
179
|
+
method: 'POST',
|
|
180
|
+
url: '/api/v1/feed/reels_media/',
|
|
181
|
+
form: this.client.request.sign({
|
|
182
|
+
user_ids: ids,
|
|
183
|
+
_uuid: this.client.state.uuid,
|
|
184
|
+
}),
|
|
185
|
+
});
|
|
186
|
+
return response.body;
|
|
187
|
+
}
|
|
188
|
+
async getHighlightById(highlightId) {
|
|
189
|
+
return this.getHighlight(highlightId);
|
|
190
|
+
}
|
|
191
|
+
async viewers(storyId) {
|
|
192
|
+
const response = await this.client.request.send({
|
|
193
|
+
method: 'GET',
|
|
194
|
+
url: `/api/v1/media/${storyId}/list_reel_media_viewer/`,
|
|
195
|
+
});
|
|
196
|
+
return response.body;
|
|
197
|
+
}
|
|
198
|
+
async deleteStory(storyId) {
|
|
199
|
+
return this.client.media.delete(storyId, 'STORY');
|
|
200
|
+
}
|
|
201
|
+
async downloadByUrl(url) {
|
|
202
|
+
const axios = require('axios');
|
|
203
|
+
const response = await axios.get(url, { responseType: 'arraybuffer' });
|
|
204
|
+
return Buffer.from(response.data);
|
|
205
|
+
}
|
|
206
|
+
async download(storyPk) {
|
|
207
|
+
var _a;
|
|
208
|
+
const result = await this.client.media.info(storyPk);
|
|
209
|
+
const items = result.items || [result];
|
|
210
|
+
const item = items[0] || result;
|
|
211
|
+
if (item.video_versions && item.video_versions.length > 0) {
|
|
212
|
+
return this.downloadByUrl(item.video_versions[0].url);
|
|
213
|
+
}
|
|
214
|
+
const candidates = ((_a = item.image_versions2) === null || _a === void 0 ? void 0 : _a.candidates) || [];
|
|
215
|
+
if (candidates.length > 0) {
|
|
216
|
+
return this.downloadByUrl(candidates[0].url);
|
|
217
|
+
}
|
|
218
|
+
throw new Error('No media URL found for story');
|
|
219
|
+
}
|
|
220
|
+
async createHighlight(options = {}) {
|
|
221
|
+
const { title, coverMediaId, mediaIds = [] } = options;
|
|
222
|
+
const response = await this.client.request.send({
|
|
223
|
+
method: 'POST',
|
|
224
|
+
url: '/api/v1/highlights/create_reel/',
|
|
225
|
+
form: this.client.request.sign({
|
|
226
|
+
_uuid: this.client.state.uuid,
|
|
227
|
+
_uid: this.client.state.cookieUserId,
|
|
228
|
+
title: title || '',
|
|
229
|
+
cover: JSON.stringify({ media_id: coverMediaId }),
|
|
230
|
+
media_ids: JSON.stringify(mediaIds),
|
|
231
|
+
}),
|
|
232
|
+
});
|
|
233
|
+
return response.body;
|
|
234
|
+
}
|
|
235
|
+
async editHighlight(highlightId, options = {}) {
|
|
236
|
+
const { title, coverMediaId, addedMediaIds = [], removedMediaIds = [] } = options;
|
|
237
|
+
const data = {
|
|
238
|
+
_uuid: this.client.state.uuid,
|
|
239
|
+
_uid: this.client.state.cookieUserId,
|
|
240
|
+
};
|
|
241
|
+
if (title)
|
|
242
|
+
data.title = title;
|
|
243
|
+
if (coverMediaId)
|
|
244
|
+
data.cover = JSON.stringify({ media_id: coverMediaId });
|
|
245
|
+
if (addedMediaIds.length > 0)
|
|
246
|
+
data.added_media_ids = JSON.stringify(addedMediaIds);
|
|
247
|
+
if (removedMediaIds.length > 0)
|
|
248
|
+
data.removed_media_ids = JSON.stringify(removedMediaIds);
|
|
249
|
+
const response = await this.client.request.send({
|
|
250
|
+
method: 'POST',
|
|
251
|
+
url: `/api/v1/highlights/${highlightId}/edit_reel/`,
|
|
252
|
+
form: this.client.request.sign(data),
|
|
253
|
+
});
|
|
254
|
+
return response.body;
|
|
255
|
+
}
|
|
256
|
+
async deleteHighlight(highlightId) {
|
|
257
|
+
const response = await this.client.request.send({
|
|
258
|
+
method: 'POST',
|
|
259
|
+
url: `/api/v1/highlights/${highlightId}/delete_reel/`,
|
|
260
|
+
form: this.client.request.sign({
|
|
261
|
+
_uuid: this.client.state.uuid,
|
|
262
|
+
_uid: this.client.state.cookieUserId,
|
|
263
|
+
}),
|
|
264
|
+
});
|
|
265
|
+
return response.body;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
module.exports = StoryRepository;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const Repository = require('../core/repository');
|
|
2
|
+
class TimelineRepository extends Repository {
|
|
3
|
+
async reels(amount = 10, lastMediaPk = 0) {
|
|
4
|
+
return this._reelsTimelineMedia('clips/connected/', amount, lastMediaPk);
|
|
5
|
+
}
|
|
6
|
+
async exploreReels(amount = 10, lastMediaPk = 0) {
|
|
7
|
+
return this._reelsTimelineMedia('clips/discover/', amount, lastMediaPk);
|
|
8
|
+
}
|
|
9
|
+
async _reelsTimelineMedia(endpoint, amount = 10, lastMediaPk = 0) {
|
|
10
|
+
const totalItems = [];
|
|
11
|
+
let nextMaxId = '';
|
|
12
|
+
while (totalItems.length < amount) {
|
|
13
|
+
try {
|
|
14
|
+
const response = await this.client.request.send({
|
|
15
|
+
method: 'POST',
|
|
16
|
+
url: `/api/v1/${endpoint}`,
|
|
17
|
+
form: { max_id: nextMaxId },
|
|
18
|
+
});
|
|
19
|
+
const body = response.body;
|
|
20
|
+
for (const item of (body.items || [])) {
|
|
21
|
+
const media = item.media || item;
|
|
22
|
+
if (lastMediaPk && String(media.pk) === String(lastMediaPk)) {
|
|
23
|
+
return totalItems;
|
|
24
|
+
}
|
|
25
|
+
totalItems.push(media);
|
|
26
|
+
}
|
|
27
|
+
const pagingInfo = body.paging_info || {};
|
|
28
|
+
if (!pagingInfo.more_available)
|
|
29
|
+
return totalItems;
|
|
30
|
+
nextMaxId = pagingInfo.max_id || '';
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
return totalItems;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return totalItems.slice(0, amount);
|
|
37
|
+
}
|
|
38
|
+
async getFeed(maxId = '', options = {}) {
|
|
39
|
+
const response = await this.client.request.send({
|
|
40
|
+
method: 'POST',
|
|
41
|
+
url: '/api/v1/feed/timeline/',
|
|
42
|
+
form: this.client.request.sign({
|
|
43
|
+
_uuid: this.client.state.uuid,
|
|
44
|
+
is_prefetch: '0',
|
|
45
|
+
feed_view_info: '[]',
|
|
46
|
+
seen_posts: '',
|
|
47
|
+
phone_id: this.client.state.phoneId,
|
|
48
|
+
battery_level: String(Math.floor(Math.random() * 50) + 50),
|
|
49
|
+
timezone_offset: String(this.client.state.timezoneOffset),
|
|
50
|
+
max_id: maxId,
|
|
51
|
+
...options,
|
|
52
|
+
}),
|
|
53
|
+
});
|
|
54
|
+
return response.body;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
module.exports = TimelineRepository;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
const Repository = require('../core/repository');
|
|
2
|
+
const crypto = require('crypto');
|
|
3
|
+
class TOTPRepository extends Repository {
|
|
4
|
+
async generateSeed() {
|
|
5
|
+
const response = await this.client.request.send({
|
|
6
|
+
method: 'POST',
|
|
7
|
+
url: '/api/v1/accounts/generate_two_factor_totp_key/',
|
|
8
|
+
form: this.client.request.sign({
|
|
9
|
+
_uuid: this.client.state.uuid,
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
return response.body.totp_seed;
|
|
13
|
+
}
|
|
14
|
+
async enable(verificationCode) {
|
|
15
|
+
const response = await this.client.request.send({
|
|
16
|
+
method: 'POST',
|
|
17
|
+
url: '/api/v1/accounts/enable_totp_two_factor/',
|
|
18
|
+
form: this.client.request.sign({
|
|
19
|
+
_uuid: this.client.state.uuid,
|
|
20
|
+
verification_code: verificationCode,
|
|
21
|
+
}),
|
|
22
|
+
});
|
|
23
|
+
return response.body.backup_codes || [];
|
|
24
|
+
}
|
|
25
|
+
async disable() {
|
|
26
|
+
const response = await this.client.request.send({
|
|
27
|
+
method: 'POST',
|
|
28
|
+
url: '/api/v1/accounts/disable_totp_two_factor/',
|
|
29
|
+
form: this.client.request.sign({
|
|
30
|
+
_uuid: this.client.state.uuid,
|
|
31
|
+
}),
|
|
32
|
+
});
|
|
33
|
+
return response.body.status === 'ok';
|
|
34
|
+
}
|
|
35
|
+
generateCode(seed) {
|
|
36
|
+
const secret = this._base32Decode(seed);
|
|
37
|
+
const now = Math.floor(Date.now() / 1000);
|
|
38
|
+
const timeCode = Math.floor(now / 30);
|
|
39
|
+
return this._generateOTP(secret, timeCode);
|
|
40
|
+
}
|
|
41
|
+
_generateOTP(secret, input) {
|
|
42
|
+
if (input < 0)
|
|
43
|
+
throw new Error('Input must be positive');
|
|
44
|
+
const buffer = Buffer.alloc(8);
|
|
45
|
+
let val = input;
|
|
46
|
+
for (let i = 7; i >= 0; i--) {
|
|
47
|
+
buffer[i] = val & 0xff;
|
|
48
|
+
val = val >> 8;
|
|
49
|
+
}
|
|
50
|
+
const hmac = crypto.createHmac('sha1', secret);
|
|
51
|
+
hmac.update(buffer);
|
|
52
|
+
const hash = hmac.digest();
|
|
53
|
+
const offset = hash[hash.length - 1] & 0x0f;
|
|
54
|
+
const code = ((hash[offset] & 0x7f) << 24) |
|
|
55
|
+
((hash[offset + 1] & 0xff) << 16) |
|
|
56
|
+
((hash[offset + 2] & 0xff) << 8) |
|
|
57
|
+
(hash[offset + 3] & 0xff);
|
|
58
|
+
const otp = (code % 1000000).toString();
|
|
59
|
+
return otp.padStart(6, '0');
|
|
60
|
+
}
|
|
61
|
+
_base32Decode(input) {
|
|
62
|
+
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
|
63
|
+
let str = input.toUpperCase().replace(/=+$/, '');
|
|
64
|
+
const missing = str.length % 8;
|
|
65
|
+
if (missing)
|
|
66
|
+
str += '='.repeat(8 - missing);
|
|
67
|
+
str = str.replace(/=+$/, '');
|
|
68
|
+
let bits = '';
|
|
69
|
+
for (const char of str) {
|
|
70
|
+
const val = alphabet.indexOf(char);
|
|
71
|
+
if (val === -1)
|
|
72
|
+
continue;
|
|
73
|
+
bits += val.toString(2).padStart(5, '0');
|
|
74
|
+
}
|
|
75
|
+
const bytes = [];
|
|
76
|
+
for (let i = 0; i + 8 <= bits.length; i += 8) {
|
|
77
|
+
bytes.push(parseInt(bits.substr(i, 8), 2));
|
|
78
|
+
}
|
|
79
|
+
return Buffer.from(bytes);
|
|
80
|
+
}
|
|
81
|
+
async smsTwoFactorEnable(phoneNumber) {
|
|
82
|
+
const response = await this.client.request.send({
|
|
83
|
+
method: 'POST',
|
|
84
|
+
url: '/api/v1/accounts/send_two_factor_enable_sms/',
|
|
85
|
+
form: this.client.request.sign({
|
|
86
|
+
_uuid: this.client.state.uuid,
|
|
87
|
+
phone_number: phoneNumber,
|
|
88
|
+
}),
|
|
89
|
+
});
|
|
90
|
+
return response.body;
|
|
91
|
+
}
|
|
92
|
+
async smsTwoFactorConfirm(verificationCode) {
|
|
93
|
+
const response = await this.client.request.send({
|
|
94
|
+
method: 'POST',
|
|
95
|
+
url: '/api/v1/accounts/enable_sms_two_factor/',
|
|
96
|
+
form: this.client.request.sign({
|
|
97
|
+
_uuid: this.client.state.uuid,
|
|
98
|
+
verification_code: verificationCode,
|
|
99
|
+
}),
|
|
100
|
+
});
|
|
101
|
+
return response.body;
|
|
102
|
+
}
|
|
103
|
+
async disableSmsTwoFactor() {
|
|
104
|
+
const response = await this.client.request.send({
|
|
105
|
+
method: 'POST',
|
|
106
|
+
url: '/api/v1/accounts/disable_sms_two_factor/',
|
|
107
|
+
form: this.client.request.sign({
|
|
108
|
+
_uuid: this.client.state.uuid,
|
|
109
|
+
}),
|
|
110
|
+
});
|
|
111
|
+
return response.body;
|
|
112
|
+
}
|
|
113
|
+
async getBackupCodes() {
|
|
114
|
+
const response = await this.client.request.send({
|
|
115
|
+
method: 'POST',
|
|
116
|
+
url: '/api/v1/accounts/regen_backup_codes/',
|
|
117
|
+
form: this.client.request.sign({
|
|
118
|
+
_uuid: this.client.state.uuid,
|
|
119
|
+
}),
|
|
120
|
+
});
|
|
121
|
+
return response.body;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
module.exports = TOTPRepository;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const Repository = require('../core/repository');
|
|
2
|
+
class TrackRepository extends Repository {
|
|
3
|
+
async downloadByUrl(url) {
|
|
4
|
+
const axios = require('axios');
|
|
5
|
+
const response = await axios.get(url, { responseType: 'arraybuffer' });
|
|
6
|
+
return Buffer.from(response.data);
|
|
7
|
+
}
|
|
8
|
+
async infoByCanonicalId(musicCanonicalId) {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
const response = await this.client.request.send({
|
|
11
|
+
method: 'POST',
|
|
12
|
+
url: '/api/v1/clips/music/',
|
|
13
|
+
form: {
|
|
14
|
+
tab_type: 'clips',
|
|
15
|
+
referrer_media_id: '',
|
|
16
|
+
_uuid: this.client.state.uuid,
|
|
17
|
+
music_canonical_id: String(musicCanonicalId),
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const body = response.body;
|
|
21
|
+
const trackData = (_b = (_a = body === null || body === void 0 ? void 0 : body.metadata) === null || _a === void 0 ? void 0 : _a.music_info) === null || _b === void 0 ? void 0 : _b.music_asset_info;
|
|
22
|
+
return trackData || body;
|
|
23
|
+
}
|
|
24
|
+
async infoById(trackId, maxId = '') {
|
|
25
|
+
const data = {
|
|
26
|
+
audio_cluster_id: trackId,
|
|
27
|
+
original_sound_audio_asset_id: trackId,
|
|
28
|
+
};
|
|
29
|
+
if (maxId)
|
|
30
|
+
data.max_id = maxId;
|
|
31
|
+
const response = await this.client.request.send({
|
|
32
|
+
method: 'POST',
|
|
33
|
+
url: '/api/v1/clips/music/',
|
|
34
|
+
form: data,
|
|
35
|
+
});
|
|
36
|
+
return response.body;
|
|
37
|
+
}
|
|
38
|
+
async search(query) {
|
|
39
|
+
const response = await this.client.request.send({
|
|
40
|
+
method: 'GET',
|
|
41
|
+
url: '/api/v1/music/audio_global_search/',
|
|
42
|
+
qs: {
|
|
43
|
+
query,
|
|
44
|
+
browse_session_id: this.client.state.uuid,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
return response.body;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
module.exports = TrackRepository;
|