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

[kemonoparty] Duplicate file fix #1689

Closed
wants to merge 6 commits into from
Closed

Conversation

nixxquality
Copy link

Fixes #1667

Judging by the discussion in that thread, the first file is always duplicated in the attachments list, except for some posts which only have the image and no attachments.

This change makes it so if attachments are present it only downloads those.

It might require testing from various posts though. It worked in the one I tried for what it's worth, but I'm not too familiar with the service.

Fixes mikf#1667 

Judging by the discussion in that thread, the first file is always duplicated in the attachments list, except for some posts which only have the image and no attachments.

This change makes it so if attachments are present it only downloads those.

It might require testing from various posts though. It worked in the one I tried for what it's worth, but I'm not too familiar with the service.
@mikf
Copy link
Owner

mikf commented Jul 13, 2021

This would "break" at least Fanbox (Example) and Subscribestar (Example) posts, since the first file for those is not a duplicate of the first attachment.

Your solution could also be simplified quite a bit:

            if file and not post["attachments"]:

@nixxquality
Copy link
Author

I wasn't familiar with that syntax of checking a python list's emptiness before. This should be good.

@mikf
Copy link
Owner

mikf commented Jul 20, 2021

I've also been looking for patreon posts where this wouldn't work and haven't found any for now.
The closest was this one (nsfw) where main file and second attachment are identical, instead of the first.

@nixxquality
Copy link
Author

nixxquality commented Jul 21, 2021

I think the shorter example for the fix you posted earlier was wrong and I applied it without thinking.

I've flipped the post["attachments"] check now; it should be skipping the main file when there are attachments.

I would have liked to add some simple test cases but I'm not familiar with Python and I'm not sure where they would go, or if you think they are necessary.

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

Successfully merging this pull request may close these issues.

Kemono.party Patreon posts always contain duplicate images
2 participants