Skip to content

'NoneType' object is not iterable when downloading instagram posts from a profile #6595

Closed
@fireattack

Description

This happens from time to time, can't be reproduced reliably. Probably some weird response from the server that wasn't handled properly.

Using python 3.11 and gallery-dl source/master from a few days ago.

code gist:

from gallery_dl import config, exception, job, output

output.initialize_logging(logging.DEBUG)

'''(...some unrelated changes to config...)'''

job = job.DownloadJob("https://www.instagram.com/fruits_zipper/")
job.run()
[urllib3.connectionpool][debug] https://instagram.fhkg1-2.fna.fbcdn.net:443 "GET /v/t51.29350-15/306484339_505043044793228_7927676318165451687_n.jpg?stp=dst-jpg_e35_tt6&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi41MjB4NTIwLnNkci5mMjkzNTAuZGVmYXVsdF9pbWFnZSJ9&_nc_ht=instagram.fhkg1-2.fna.fbcdn.net&_nc_cat=108&_nc_ohc=7SPozbveK6QQ7kNvgGbsyjN&_nc_gid=448c0e003351487f8c5efbdf71f65261&edm=ABmJApABAAAA&ccb=7-5&ig_cache_key=MjkyNzExMDQ1MDc4MTIxODc5Mw%3D%3D.3-ccb7-5&oh=00_AYD5FHRi9WcG7sH56TsJjeKCYdhxM2TY4ugD2xxklmyC1A&oe=6754616B&_nc_sid=b41fef HTTP/1.1" 200 39858
G:\{masked}\fruits_zipper\220914_fruits_zipper_CifL3JNJefp.jpg
[instagram][debug] Cursor: 2927110450781218793_50858602636
[instagram][debug] Sleeping 3.79 seconds (request)
[urllib3.connectionpool][debug] https://www.instagram.com:443 "GET /api/v1/feed/user/50858602636/?count=30&max_id=2927110450781218793_50858602636 HTTP/1.1" 200 44551
[instagram][error] An unexpected error occurred: TypeError - 'NoneType' object is not iterable. Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues .
[instagram][debug]
Traceback (most recent call last):
  File "C:\Users\ikena\AppData\Local\Programs\Python\Python311\Lib\site-packages\gallery_dl\job.py", line 151, in run
    for msg in extractor:
  File "C:\Users\ikena\AppData\Local\Programs\Python\Python311\Lib\site-packages\gallery_dl\extractor\instagram.py", line 75, in items
    post = self._parse_post_rest(post)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ikena\AppData\Local\Programs\Python\Python311\Lib\site-packages\gallery_dl\extractor\instagram.py", line 223, in _parse_post_rest
    for num, item in enumerate(items, 1):
                     ^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not iterable
[instagram][info] Use '-o cursor=2927110450781218793_50858602636' to continue downloading from the current position

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions