nodejs-insta-private-api-mqt 1.3.76 → 1.3.78
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 +9 -4
- package/dist/repositories/account.repository.js +831 -764
- package/package.json +1 -1
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
|
}
|