Skip to content

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

@ahmadrabea

Description

@ahmadrabea

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 ,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions