-
-
Notifications
You must be signed in to change notification settings - Fork 951
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
[pixiv] No random tags sorting #3266
Comments
Tags get returned in the same order as provided by Pixiv. gallery-dl/gallery_dl/extractor/pixiv.py Line 45 in a24dcbe
|
I use Python 3.9.13. |
Here is the problem code work["tags"] = list(set(tag["translated_name"] or tag["name"] for tag in work["tags"])) gallery-dl/gallery_dl/extractor/pixiv.py Lines 40 to 42 in a24dcbe
Because of |
https://stackoverflow.com/questions/7961363/removing-duplicates-in-lists It suggests to use |
Yes, it works fine. Checked. ...
import hashlib
+ from collections import OrderedDict
...
def transform_tags(work):
- work["tags"] = list(set(
+ work["tags"] = list(OrderedDict.fromkeys(
tag["translated_name"] or tag["name"]
for tag in work["tags"]))
...
|
for '"tags": "translated"' As it turns out, set() does *not* preserve insertion order.
I noted that my config: #3265 (comment)
(that uses
<div class="tags">["{tags:J", "}"]</div>
in themetadata
postprocessor)produces always the different metadata files since the tags are randomly sorted.
For example,
https://www.pixiv.net/ajax/illust/63625443
API returns tags with the same order for each requests, so it's seems like a bug.The text was updated successfully, but these errors were encountered: