-
-
Notifications
You must be signed in to change notification settings - Fork 941
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
[deviantart] fix crash when handling deleted deviations in status updates #3656
Conversation
in status updates
We could just add a flag (or >=2, if necessary) to each deviation ID to know which ones are already downloaded/whatever, which is a drop in the ocean in RAM usage. If the flag is missing or equals "not downloaded" (or whatever the precise wording is), skip it. |
This has already been fixed, it's just not part of this PR. It's actually more complicated than that because dA's metadata endpoint doesn't like duplicate UUIDs, and I ended up deduplicating them using a The first issue was fixed by using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you and my condolences for having to deal with DA's inner workings yet again. Why oh why does this site have to be so complicated?
gallery_dl/extractor/deviantart.py
Outdated
if results: | ||
if "deviationid" in results[0]: | ||
if self.metadata: | ||
self._metadata(results) | ||
if self.folders: | ||
self._folders(results) | ||
else: | ||
# attempt to fix "deleted" deviations | ||
for result in results: | ||
for item in result.get("items") or (): | ||
if "deviation" not in item or \ | ||
not item["deviation"]["is_deleted"]: | ||
continue | ||
patch = self._call( | ||
"/deviation/" + | ||
item["deviation"]["deviationid"], | ||
fatal=False) | ||
if patch: | ||
item["deviation"] = patch | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought, but maybe it'd be better to use a separate _pagination
method for status items? Or at least put fixing deleted deviations in its own method.
I admit to having done this myself (plenty of times?) , but it hurts even me seeing ~50 spaces of indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation here will be different if combined with this branch, which is almost done (I think). I'll try to refactor this section to make it look nicer though.
gallery_dl/extractor/deviantart.py
Outdated
patch = self._call( | ||
"/deviation/" + | ||
item["deviation"]["deviationid"], | ||
fatal=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use self.deviation()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now (at least on this branch) neither metadata
nor folders
is supposed to work for shared deviations, and I'd rather not make an exception for "deleted" deviations. This will be fixed by this branch, which uses _call
to bypass _metadata
and _folders
to make API calls more efficient.
Example:
This deviation isn't actually deleted and can be fetched as usual using the
deviation
endpoint.I've been working on several features and bugfixes for DA extractors and this is one of them. Unfortunately they are heavily intertwined with each other, so I'm trying my best to separate them into branches and reduce the overall complexity.
Known issues:
items
andextra
is enabled, these deviations will be extracted twicemetadata
andfolders
doesn't work for deviations initems
deviation
endpoint will be called multiple timesCurrently WIP features/bugfixes that will address these issues or affect the implementation of this fix:
unique
option to prevent duplicates (including stash)