InstaLooter
InstaLooter copied to clipboard
'NoneType' object has no attribute 'group'
Library version
What's the installed library version ? Check with instalooter --version
:
instalooter v2.0.3
Environment
Describe here your environment, including:
- Debian 9 Stretch
- Python 3.5.3
Error description - runtime
When I trying to login to Instagram with instalooter, instalooter asks for 'Username' and 'Password'. It doesn't login and throws the following error: CRITICAL 'NoneType' object has no attribute 'group' WARNING unclosed <ssl.SSLSocket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('myiphere', 52704), raddr=('179.60.195.32', 443)>
If you have an issue at runtime, include the required information below:
Reproducible test case
instalooter login
Expected behaviour
instalooter logs into Instagram and returns to the prompt after asking for my Username and Password
Actual behaviour
Asks for Username and Password and then throws the following error:
CRITICAL 'NoneType' object has no attribute 'group' WARNING unclosed <ssl.SSLSocket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('myiphere', 52704), raddr=('179.60.195.32', 443)>
Traceback
Traceback (most recent call last): File "/home/acloserview/.local/lib/python3.5/site-packages/instalooter/cli/init.py", line 104, in main login(args) File "/home/acloserview/.local/lib/python3.5/site-packages/instalooter/cli/login.py", line 22, in login InstaLooter._login(username, password) File "/home/acloserview/.local/lib/python3.5/site-packages/instalooter/looters.py", line 143, in _login token = get_shared_data(login.text)['config']['csrf_token'] File "/home/acloserview/.local/lib/python3.5/site-packages/instalooter/_utils.py", line 94, in get_shared_data return json.loads(match.group(1)) AttributeError: 'NoneType' object has no attribute 'group'
I am having this issue as well. Do I need to write my command different? instalooter user bob ./instagram/bob -T {id}.{date} -N -m --username bob
I'm getting the same thing in Windows 10.
Same over here on Windows 10 Python version 3.6.5
Same. Raspbian Stretch - Python 2.7.13.
Same instalooter v2.0.3 python 2.7 on Ubuntu 16.04
I believe this has to do with a change in what's returned from Instagram when posting to the login url; looters.py attempts to pull the CSRF token using get_shared_data but the _sharedData window object is not (or perhaps no longer) on the response page.
Check my fork with tweaks to _utils.py and looters.py for a temporary workaround; note you'll need to pass your username with the command and will probably need to run it twice so this is indeed a clunky workaround rather than a solution.
Workaround works great, thanks so much!
The reason so many persons have this issue is because it's extremely generic and occurs whenever an HTML tag is not found. It can be caused by a change in the page template, a connection error, a denied request, an invalid authentication, and more
@scottbcovert : If you want to, you can open a PR and I'll try to build your workaround :smiley:
Sounds good, thanks @althonos - I didn't open one originally thinking it was too much of a hack so feel free to reject/tweak as needed
did @scottbcovert 's workaround.. getting this message in return..
invalid format for --time parameter: None (format is [D]:[D] where D is an ISO 8601 date)
Has the PR for this been accepted yet? @althonos
After using @scottbcovert's workaround I got this message when trying to log in: ValueError: timestamp out of range for platform time_t
With some research I found out that it's a bug with LWPCookieJar
that only affects 32-bit machines (I'm using Android 32-bit with Termux).
Here's the bug report: https://bugs.python.org/issue5537
After adding the patch mentioned in the report the log in feature works fine. I don't know if I should open a new issue for this.
@zAndryZ : feel free to open an issue for this; in particular, we could discuss there about switching to MozillaCookieJar
if it's not buggy on your platform.
@ all :
This issue will be patched in the v2.1.0
, including the invalid format for --time parameter
part. Please not that downloading from a private profile is very likely to be broken because of changes in IG, so please open another issue when it gets confirmed.
I'm getting this issue still with 2.3.4 when doing a download of a public profile. It seems to only happen when I pass the -T option. If I leave that out, it works fine.
2019-03-13 21:39:35 precisionM6700 instalooter.cli[26339] NOTICE Starting download of `someuser`
40%|███████████████████████████████████████████████████████▌ | 2/5 [00:02<00:03, 1.26s/it2019-03-13 21:39:45 precisionM6700 instalooter.cli[26339] CRITICAL 'NoneType' object has no attribute 'group' | 14/230 [00:07<09:11, 2.55s/it]
2019-03-13 21:39:45 precisionM6700 instalooter.cli[26339] NOTICE Terminating 16 remaining workers...
Exception ignored in: <function tqdm.__del__ at 0x7f52a04fd488>
Traceback (most recent call last):
File "/opt/Python-3.7.0/lib/python3.7/site-packages/tqdm/_tqdm.py", line 885, in __del__
self.close()
File "/opt/Python-3.7.0/lib/python3.7/site-packages/tqdm/_tqdm.py", line 1090, in close
self._decr_instances(self)
File "/opt/Python-3.7.0/lib/python3.7/site-packages/tqdm/_tqdm.py", line 441, in _decr_instances
cls._instances.remove(instance)
File "/opt/Python-3.7.0/lib/python3.7/_weakrefset.py", line 109, in remove
self.data.remove(ref(item))
KeyError: <weakref at 0x7f529f49d908; to 'TqdmProgressBar' at 0x7f529f3aa4e0>
Sorry for comment in an old issue, but me and my friend have met the same issue recently when downloading by hashtag, the version is 2.4.0. @althonos
I see that this 'group' attribute is in method 'get_shared_data()' in _utils.py, and randomly variable 'match' caould be 'None'. And then looters.py uses this method which could possibly cause this problem... I'm wondering what is 'match' looks like? If it is a random error and seldom occured, can we skip this html (or post) if it is None? Maybe could do help to resolve the problem?@althonos
I did some workaround seems to fix the issue temporarily, #255
How do you use the workaround? Im new to coding. @roy668899 @scottbcovert @bradbenn
I tried to read this thread but still can't figure out my error. Could some one help me out.
looter = ProfileLooter(acc) looter.download('~/Pictures', media_count=5)
This is the coding part
The error it arises is similar to the previous.
Could someone please help me out