nodejs-insta-private-api-mqt 1.3.76 → 1.3.77
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/core/request.js
CHANGED
|
@@ -185,12 +185,17 @@ class Request {
|
|
|
185
185
|
|
|
186
186
|
// Update cookies from Set-Cookie headers (if cookieJar is available)
|
|
187
187
|
const setCookieHeaders = headers['set-cookie'] || headers['Set-Cookie'];
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
const jar = this.client.state && (this.client.state.cookieJar || this.client.state.cookieStore);
|
|
189
|
+
if (setCookieHeaders && jar) {
|
|
190
|
+
const cookieArray = Array.isArray(setCookieHeaders) ? setCookieHeaders : [setCookieHeaders];
|
|
191
|
+
cookieArray.forEach(cookieString => {
|
|
190
192
|
try {
|
|
191
|
-
// host constant fallback if available
|
|
192
193
|
const host = (this.client.state.constants && this.client.state.constants.HOST) ? this.client.state.constants.HOST : 'https://i.instagram.com';
|
|
193
|
-
|
|
194
|
+
if (typeof jar.setCookieSync === 'function') {
|
|
195
|
+
jar.setCookieSync(cookieString, host);
|
|
196
|
+
} else if (typeof jar.setCookie === 'function') {
|
|
197
|
+
jar.setCookie(cookieString, host, () => {});
|
|
198
|
+
}
|
|
194
199
|
} catch (e) {
|
|
195
200
|
// ignore cookie parsing errors
|
|
196
201
|
}
|
|
@@ -114,8 +114,8 @@ class AccountRepository extends Repository {
|
|
|
114
114
|
'X-FB-Connection-Type': 'MOBILE.LTE',
|
|
115
115
|
'X-FB-Network-Properties': 'VPN;Metered;Validated;LocalAddrs=/10.0.0.2,;',
|
|
116
116
|
'X-FB-Conn-UUID-Client': crypto.randomBytes(16).toString('hex'),
|
|
117
|
-
'Accept-Encoding': '
|
|
118
|
-
'X-FB-HTTP-Engine': '
|
|
117
|
+
'Accept-Encoding': 'gzip, deflate',
|
|
118
|
+
'X-FB-HTTP-Engine': 'Liger',
|
|
119
119
|
};
|
|
120
120
|
|
|
121
121
|
const response = await this.client.request.send({
|
|
@@ -183,6 +183,41 @@ class AccountRepository extends Repository {
|
|
|
183
183
|
err.challengeInfo = body.challenge || null;
|
|
184
184
|
throw err;
|
|
185
185
|
}
|
|
186
|
+
|
|
187
|
+
const bearerMatch = layoutStr.match(/Bearer IGT:2:[A-Za-z0-9+\/=]+/);
|
|
188
|
+
if (bearerMatch) {
|
|
189
|
+
this.client.state.authorization = bearerMatch[0];
|
|
190
|
+
this.client.state.updateAuthorization();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const pkMatch = layoutStr.match(/\\"pk\\":(\d+)/);
|
|
194
|
+
if (pkMatch) {
|
|
195
|
+
this.client.state.cookieUserId = pkMatch[1];
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const wwwClaimMatch = layoutStr.match(/IG-Set-WWW-Claim[\\"\s:]+([a-f0-9]+)/i);
|
|
199
|
+
if (wwwClaimMatch) {
|
|
200
|
+
this.client.state.igWWWClaim = wwwClaimMatch[1];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const encKeyIdMatch = layoutStr.match(/IG-Set-Password-Encryption-Key-Id[\\"\s:]+(\d+)/i);
|
|
204
|
+
if (encKeyIdMatch) {
|
|
205
|
+
this.client.state.passwordEncryptionKeyId = parseInt(encKeyIdMatch[1]);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const encPubKeyMatch = layoutStr.match(/IG-Set-Password-Encryption-Pub-Key[\\"\s:]+([A-Za-z0-9+\/=]+)/i);
|
|
209
|
+
if (encPubKeyMatch) {
|
|
210
|
+
this.client.state.passwordEncryptionPubKey = encPubKeyMatch[1];
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const loginResponseMatch = layoutStr.match(/\\"logged_in_user\\":\{[^}]*\\"pk\\":(\d+)[^}]*\\"username\\":\\"([^"\\]+)\\"/);
|
|
214
|
+
if (loginResponseMatch) {
|
|
215
|
+
return {
|
|
216
|
+
pk: parseInt(loginResponseMatch[1]),
|
|
217
|
+
pk_id: loginResponseMatch[1],
|
|
218
|
+
username: loginResponseMatch[2],
|
|
219
|
+
};
|
|
220
|
+
}
|
|
186
221
|
}
|
|
187
222
|
|
|
188
223
|
if (body.logged_in_user) {
|
package/package.json
CHANGED