@devmaarkn/instagram-private-api
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -21,2 +21,8 @@ /// <reference types="node" /> | ||
}): Promise<any>; | ||
createWebAjax({ username, password, email, first_name }: { | ||
username: any; | ||
password: any; | ||
email: any; | ||
first_name: any; | ||
}): Promise<any>; | ||
currentUser(): Promise<import("../responses").AccountRepositoryCurrentUserResponseUser>; | ||
@@ -23,0 +29,0 @@ setBiography(text: string): Promise<import("../responses").AccountRepositoryCurrentUserResponseUser>; |
@@ -158,2 +158,39 @@ "use strict"; | ||
} | ||
async createWebAjax({ username, password, email, first_name }) { | ||
if (!this.client.state.passwordEncryptionPubKey) { | ||
await this.client.qe.syncLoginExperiments(); | ||
} | ||
const { encrypted, time } = this.encryptPassword(password); | ||
const { body } = await Bluebird.try(() => this.client.request.send({ | ||
method: 'POST', | ||
url: '/api/v1/web/accounts/web_create_ajax/attempt/', | ||
form: this.client.request.sign({ | ||
username, | ||
email, | ||
first_name, | ||
enc_password: `#PWD_INSTAGRAM:4:${time}:${encrypted}`, | ||
guid: this.client.state.uuid, | ||
device_id: this.client.state.deviceId, | ||
_csrftoken: this.client.state.cookieCsrfToken, | ||
force_sign_up_code: '', | ||
qs_stamp: '', | ||
waterfall_id: this.client.state.uuid, | ||
phone_id: this.client.state.phoneId, | ||
sn_nonce: '', | ||
sn_result: '', | ||
}), | ||
})).catch(errors_1.IgResponseError, error => { | ||
console.log(error); | ||
switch (error.response.body.error_type) { | ||
case 'signup_block': { | ||
AccountRepository.accountDebug('Signup failed'); | ||
throw new ig_signup_block_error_1.IgSignupBlockError(error.response); | ||
} | ||
default: { | ||
throw error; | ||
} | ||
} | ||
}); | ||
return body; | ||
} | ||
async currentUser() { | ||
@@ -160,0 +197,0 @@ const { body } = await this.client.request.send({ |
{ | ||
"name": "@devmaarkn/instagram-private-api", | ||
"description": "Instagram private API wrapper for full access to instagram", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "types": "dist/index.d.ts", |
Sorry, the diff of this file is not supported yet
993131
17740