add '--filter' command-line option

This allows for image filtering via Python expressions by the same
metadata that is also used to build filenames (--list-keywords).

The usually shunned eval() function is used to evaluate
filter-expressions, but it seemed quite appropriate in this case and
shouldn't introduce any new security issues, as any attacker that could do
> gallery-dl --filter "delete-everything()" ...
could as well do
> python -c "delete-everything()"
This commit is contained in:
Mike Fährmann
2017-09-08 17:52:00 +02:00
parent 31731cbefe
commit 9b21d3f13c
7 changed files with 86 additions and 21 deletions

View File

@@ -291,7 +291,7 @@ class DeviantartCollectionExtractor(DeviantartExtractor):
r"/favourites/(\d+)/([^/?&#]+)"]
test = [("http://rosuuri.deviantart.com/favourites/58951174/Useful", {
"url": "f0c12581060aab9699289817b39804d9eb88f675",
"keyword": "e0ed920fb3dfdad9294be592be2eeb3dc1258a6a",
"keyword": "2778b4abaac240ff6fb1d630d7b04b8e983ef9c4",
})]
def __init__(self, match):