Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'NoneType' object has no attribute 'group' #363

Open
ahmadrabea opened this issue Oct 7, 2022 · 7 comments
Open

'NoneType' object has no attribute 'group' #363

ahmadrabea opened this issue Oct 7, 2022 · 7 comments

Comments

@ahmadrabea
Copy link

ahmadrabea commented Oct 7, 2022

Library version

instalooter v2.4.4

Environment

  • windwos10 64-bit
  • Python version 3.10.4

Error description - runtime

Reproducible test case

from instalooter.looters import ProfileLooter
looter = ProfileLooter("funny")
looter.download('./Pictures', media_count=50)

Expected behaviour

download media

Actual behaviour

Traceback (most recent call last):
  File "c:\Users\Ahmad\Desktop\YTBot\automated_youtube_channel\instalooter_test.py", line 2, in <module>
    looter = ProfileLooter("funny")
  File "C:\Users\Ahmad\AppData\Roaming\Python\Python310\site-packages\instalooter\looters.py", line 705, in __init__
    super(ProfileLooter, self).__init__(**kwargs)
  File "C:\Users\Ahmad\AppData\Roaming\Python\Python310\site-packages\instalooter\looters.py", line 287, in __init__
    token = get_shared_data(res.text)['config']['csrf_token']
  File "C:\Users\Ahmad\AppData\Roaming\Python\Python310\site-packages\instalooter\_utils.py", line 94, in get_shared_data
    return json.loads(match.group(1))
AttributeError: 'NoneType' object has no attribute 'group'

Hint

the regex return none here (match is none)

def get_shared_data(html):
    match = re.search(r'window._sharedData = ({[^\n]*});', html)
    return json.loads(match.group(1))

after investigation
I can see that the res.text is not getting the expected response ,

@FlutterFraz
Copy link

Hello, I'm stuck at your same point and i agree with your investigation. Have you found any fix or workaround?

@LucasSnatiago
Copy link

I'm with the same problem, any solution?

@ahmadrabea
Copy link
Author

@FlutterFraz
unfortunately, No

@cameron-astor
Copy link

I have encountered this same issue as well.

@9x3l6
Copy link

9x3l6 commented Jan 3, 2023

Same issue 2.4.4

instalooter.cli[43626] CRITICAL 'NoneType' object has no attribute 'group'

the problem is potentially in one of these two files...

instalooter/looters.py

instalooter/_utils.py

https://github.com/althonos/InstaLooter/search?q=group

UPDATE:

the problem is that the html from the instagram response changed and no longer has window._sharedData as expected on line 77 in _utils.py

    match = re.search(r'window._sharedData = ({[^\n]*});', html)

the html doesn't have that text to find and match anymore, therefore the tool needs an update or it won't work anymore

https://github.com/althonos/InstaLooter/blob/master/instalooter/_utils.py#L77

@girosiz
Copy link

girosiz commented Feb 20, 2023

Same issue 2.4.4

instalooter.cli[43626] CRITICAL 'NoneType' object has no attribute 'group'

the problem is potentially in one of these two files...

instalooter/looters.py

instalooter/_utils.py

https://github.com/althonos/InstaLooter/search?q=group

UPDATE:

the problem is that the html from the instagram response changed and no longer has window._sharedData as expected on line 77 in _utils.py

    match = re.search(r'window._sharedData = ({[^\n]*});', html)

the html doesn't have that text to find and match anymore, therefore the tool needs an update or it won't work anymore

https://github.com/althonos/InstaLooter/blob/master/instalooter/_utils.py#L77

Same issue 2.4.4

instalooter.cli[43626] CRITICAL 'NoneType' object has no attribute 'group'

the problem is potentially in one of these two files...

instalooter/looters.py

instalooter/_utils.py

https://github.com/althonos/InstaLooter/search?q=group

UPDATE:

the problem is that the html from the instagram response changed and no longer has window._sharedData as expected on line 77 in _utils.py

    match = re.search(r'window._sharedData = ({[^\n]*});', html)

the html doesn't have that text to find and match anymore, therefore the tool needs an update or it won't work anymore

https://github.com/althonos/InstaLooter/blob/master/instalooter/_utils.py#L77

Hi, having the same issue, and wondering if I could possibly use the same fix and where, my code looks somewhat like this: `from instalooter.looters import ProfileLooter
import datetime
import dateutil.relativedelta

instalooter_test downloads videos posted by daquan in the last month

Instanciate

looter = ProfileLooter("daquan", videos_only=True, template="{id}-{username}-{width}-{height}")
looter.login("", "")

today = datetime.date.today()
thismonth = (today, today - dateutil.relativedelta.relativedelta(days=28))

looter.download('./Memes_December_4', media_count=50, timeframe=thismonth)

loader.load_session_from_file(auth['username'], auth['username'] + auth['password'])
except:
loader.login(auth['username'], auth['password'])
loader.save_session_to_file(auth['username'] + auth['password'])

and the response I get from: automated_youtube_channel> instalooter login
Username: failmarket
Password:
2023-02-20 11:24:12 DESKTOP-B227JC4 instalooter.cli[23176] CRITICAL 'NoneType' object has no attribute 'group'
2023-02-20 11:24:12 DESKTOP-B227JC4 instalooter.cli[23176] WARNING unclosed <ssl.SSLSocket fd=932, family=2, type=1, proto=0, laddr=('192.168.1.4', 59172), raddr=('157.240.194.174', 443)>

`

@steinarb
Copy link

I have the same problem on debian 11.6 "bullseye"

I installed pip with:

apt install python3-pip

I then installed instalooter as my own user, with:

pip3 install --user instalooter --pre

Then I tried running the instalooter command:

sb@marquez:~$ cd Pictures/
sb@marquez:~/Pictures$ mkdir kaninen_daisy
sb@marquez:~/Pictures$ cd kaninen_daisy/
sb@marquez:~/Pictures/kaninen_daisy$ instalooter user kaninen_daisy
2023-04-17 21:28:52 marquez instalooter.cli[299841] CRITICAL 'NoneType' object has no attribute 'group'
sb@marquez:~/Pictures/kaninen_daisy$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants