Comments (13)
Still working for me, can you give me more details about the error (like the line number) ?
from myigbot.
Sure.
Traceback (most recent call last):
File "c:\Users\name\Desktop\Youtube script\instagram3.py", line 11, in
bot = ig("name", "pw", proxy=proxies)
File "c:\languages\lib\site-packages\myigbot_init_.py", line 61, in init
self.csrf_token = cookie_jar['csrftoken']
KeyError: 'csrftoken'
from myigbot.
Btw. I shortened MyIGBot to ig.
"from myigbot import MyIGBot as ig"
from myigbot.
I put a print(json_data) in the init() of MyIGBot and I am getting this:
{'message': '', 'two_factor_required': True, 'two_factor_info': {'username': 'Something', 'sms_two_factor_on': False, 'totp_two_factor_on': True, 'obfuscated_phone_number': '', 'two_factor_identifier': 'Something', 'show_messenger_code_option': False, 'show_new_login_screen': True, 'show_trusted_device_option': True, 'should_opt_in_trusted_device_option': True, 'pending_trusted_notification': False, 'sms_not_allowed_reason': None, 'phone_verification_settings': {'max_sms_count': 2, 'resend_sms_delay_sec': 60, 'robocall_count_down_time_sec': 30, 'robocall_after_max_sms': True}}, 'phone_verification_settings': {'max_sms_count': 2, 'resend_sms_delay_sec': 60, 'robocall_count_down_time_sec': 30, 'robocall_after_max_sms': True}, 'status': 'fail', 'error_type': 'two_factor_required'}
Seems like it wants me to use two factor auth., but in the init() it does that process later when it is already too late.
from myigbot.
Sure.
Traceback (most recent call last):
File "c:\Users\name\Desktop\Youtube script\instagram3.py", line 11, in
bot = ig("name", "pw", proxy=proxies)
File "c:\languages\lib\site-packages\myigbot__init__.py", line 61, in init
self.csrf_token = cookie_jar['csrftoken']
KeyError: 'csrftoken'
I just updated the repo (not the package) can you clone this again and try?
from myigbot.
Sure.
Here's the traceback:
File "c:\languages\lib\site-packages\myigbot_init_.py", line 181, in init
self.sessionid = login_response.headers['Set-Cookie'].split('sessionid=')[1].split(';')[0]
IndexError: list index out of range
from myigbot.
I printed login_response.headers['Set-Cookie'] and this was the ouput:
csrftoken=""; Domain=instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/, csrftoken=""; Domain=.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/, csrftoken=""; Domain=i.instagram.com; expires=Thu, 01-Jan-1970
00:00:00 GMT; Max-Age=0; Path=/, csrftoken=""; Domain=.i.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/, csrftoken=""; Domain=www.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/, csrftoken=""; Domain=.www.instagram.com; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/, csrftoken=""; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/
There is no sessionid anywhere. Thus it cannot be splitted.
from myigbot.
Ok, I have found more information now.
It goes the two factor required way, BUT it stops and skips when it tries to assign the cookie_jar elements to the class attributes.
Which means that the cookie_jar is still empty and we're back where we started :D
try:
if json_data["two_factor_required"]:
self.ig_nrcb = cookie_jar['ig_nrcb']
self.ig_did = cookie_jar['ig_did']
self.mid = cookie_jar['mid']
from myigbot.
This one is a bit off-topic, but might be related.
Inside MyIGBot we have:
payload = {
'username': self.username,
'enc_password': f'#PWD_INSTAGRAM_BROWSER:0:{time_now}:{self.password}',
'queryParams': {},
'optIntoOneTap': 'false'
}
self.password is the password itself without going through an encryption process.
I was analyzing the Instagram traffic with Fiddler and found that enc_password was encrypted with aes 256.
Here they're going more in-depth about it:
https://stackoverflow.com/questions/62076725/instagram-enc-password-generation
from myigbot.
Turns out, it was not off-topic, but important for it to work lol.
I modified your code and took the encrypted password and put into payload's enc_param as self.password.
Now I am getting:
[✗] Login Failed! {"user": true, "authenticated": false, "status": "ok"}
At least some progress
from myigbot.
I have some positive news again. I have been trying to shrink the request from the analyzing tool. The following code gives me a new csrftoken, id_did and mid!
import requests
link = 'https://www.instagram.com/'
headers = {
"User-Agent": "",
"Cookie": 'ig_cb=2',
}
response = requests.get(link, headers=headers)
print(response.cookies)
from myigbot.
from myigbot.
Ok, I have solved it and optimised the code on the way.
I will make a pull request once I am done integrating it to my main bot and look at the differences between mine and your version.
Btw. "self.ig_nrcb = cookie_jar['ig_nrcb']" is not needed. Not sure why it is in there.
from myigbot.
Related Issues (20)
- Discussion about Instagram Rate limits (using story_view function) HOT 3
- No issue. I am just being thankful to you for your services :) HOT 1
- Login Failed HOT 9
- Getting 403 error when login HOT 6
- Get usernames who are tagged in a post
- Possible to Upload Story with tag on it?
- información perfiles privado o perfiles publicos que no aceptan que los etiqueten
- csrftoken HOT 1
- Support stories highlighting
- Suspicious login attempt HOT 3
- KeyError: 'upload_id' HOT 1
- May i know how to by pass suspicious login attempt pls? HOT 1
- 1
- Upload multiple image posts
- UTF-8 captions not allowed, it forces Latin-1 encoding on caption text
- Error 403 in Like HOT 1
- can't comment on stories
- ModuleNotFoundError: No module named 'cv2' (Details Below) HOT 4
- Cookie file is corrupted HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from myigbot.