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

Instaloader.download_post(): ZeroDivisionError: integer division or modulo by zero #1085

Open
skrull opened this issue Apr 9, 2021 · 13 comments · May be fixed by #2214
Open

Instaloader.download_post(): ZeroDivisionError: integer division or modulo by zero #1085

skrull opened this issue Apr 9, 2021 · 13 comments · May be fixed by #2214
Labels
bug Bug good first issue Easy to tackle, good starting point for new Instaloader contributors leave open Not closed automatically due to inactivity

Comments

@skrull
Copy link

skrull commented Apr 9, 2021

version: 4.7.1
command line: instaloader --commit-mode --login=(stripped) --sessionfile session --no-posts --abort-on=302,400,429 --tagged user

[ 30] Traceback (most recent call last):
File "pvenv/bin/instaloader", line 8, in
sys.exit(main())
File "pvenv/lib/python3.8/site-packages/instaloader/main.py", line 445, in main
_main(loader,
File "pvenv/lib/python3.8/site-packages/instaloader/main.py", line 211, in _main
instaloader.download_profiles(profiles,
File "pvenv/lib/python3.8/site-packages/instaloader/instaloader.py", line 1274, in download_profiles
self.download_tagged(profile, fast_update=fast_update, post_filter=post_filter)
File "pvenv/lib/python3.8/site-packages/instaloader/instaloader.py", line 1119, in download_tagged
self.posts_download_loop(profile.get_tagged_posts(),
File "pvenv/lib/python3.8/site-packages/instaloader/instaloader.py", line 922, in posts_download_loop
downloaded = self.download_post(post, target=target)
File "pvenv/lib/python3.8/site-packages/instaloader/instaloader.py", line 618, in download_post
for i in range(self.slide_start % post.mediacount, self.slide_end % post.mediacount + 1)),
ZeroDivisionError: integer division or modulo by zero

@Deleora
Copy link

Deleora commented Apr 12, 2021

Just curious, what's the point of using both --login and --sessionfile?

@skrull
Copy link
Author

skrull commented Apr 12, 2021

Nothing really important, but it just asks the password if the session file is missing.

@aandergr
Copy link
Member

How is this reproducible?

@skrull
Copy link
Author

skrull commented Apr 19, 2021

There you go.

https://pastebin.com/tf4Hy24b

@aandergr
Copy link
Member

Thanks. Also reproducible with: instaloader -- -CNLdFNkBuM1 (downloading the single post that fails)

@aandergr aandergr added the bug Bug label Apr 22, 2021
@aandergr aandergr changed the title Error: division by zero Instaloader.download_post(): ZeroDivisionError: integer division or modulo by zero May 8, 2021
@github-actions
Copy link

There has been no activity on this issue for an extended period of time. This issue will be closed after further 14 days of inactivity.

@github-actions github-actions bot added the stale Issue is inactive for a long time label Sep 21, 2021
@github-actions github-actions bot closed this as completed Oct 5, 2021
@aandergr
Copy link
Member

aandergr commented Oct 7, 2021

Mentioned post does not exist anymore. Is there any other post for which this error happens?

@aandergr aandergr removed the stale Issue is inactive for a long time label Oct 7, 2021
@skrull
Copy link
Author

skrull commented Nov 18, 2021

@aandergr sorry about the delay. Got it again yesterday.

https://pastebin.com/nn8brAaG

@github-actions
Copy link

There has been no activity on this issue for an extended period of time. This issue will be closed after further 14 days of inactivity.

@github-actions github-actions bot added the stale Issue is inactive for a long time label Apr 12, 2022
@QrchackOfficial
Copy link

I'm having the same issue. Seems like post.mediacount is 0 for some reason and instaloader does self.slide_start % post.mediacount without checking, causing the whole program to crash. Perhaps some change on Instagram's end, or a form of rate limiting? Or possibly something to do with removed/edited posts... Either way, I feel like there should be a check if it's 0 and if so, instaloader should handle it gracefully - either by skipping that post by default and printing a warning (preferably), or by allowing the user to choose to do so by a command switch.

@rouncewell
Copy link

I too am having this issue. I have a large backlog of downloads and would like to continue downloading them but I can't since it keeps causing Instaloader to crash. Did anyone find a work around to this?

@aandergr aandergr added leave open Not closed automatically due to inactivity good first issue Easy to tackle, good starting point for new Instaloader contributors and removed stale Issue is inactive for a long time labels Feb 18, 2023
@aandergr aandergr reopened this Feb 18, 2023
@JunedKhan101
Copy link
Contributor

Hi @skrull I cannot access your pastebin it says:

This page is no longer available. It has either expired, been removed by its creator, or removed by one of the Pastebin staff.

SeamusMullan added a commit to SeamusMullan/instaloader that referenced this issue Mar 15, 2024
Implement check for post.mediacount before checking if posts have been downloaded.
@SeamusMullan
Copy link

I've attempted a fix for this issue #2214

@aandergr aandergr linked a pull request Mar 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug good first issue Easy to tackle, good starting point for new Instaloader contributors leave open Not closed automatically due to inactivity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants