[reddit] allow 'date-min/max' to be human readable dates

If the date-min/max config value is a string, try parsing it using
datetime.strptime [1] with 'date-format' as format string [2]
(default: "%Y-%m-%dT%H:%M:%S")

Example: get all submissions posted in 2016

$ gallery-dl reddit.com/r/... \
    -o date-format=%Y \
    -o date-min=\"2016\" \
    -o date-max=\"2017\"

[1] https://docs.python.org/3/library/datetime.html#datetime.datetime.strptime
[2] https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior
This commit is contained in:
Mike Fährmann
2017-07-01 18:46:38 +02:00
parent 4414aefe97
commit 80c2e03aaa
2 changed files with 19 additions and 16 deletions

View File

@@ -23,7 +23,6 @@ class TumblrUserExtractor(Extractor):
test = [("http://demo.tumblr.com/", {
"url": "5c113da25a605b7449de8ca1606eec5502b4dc9f",
"keyword": "d2cf142bcaf1cbea29291f8c8ccb5f582962d8be",
"content": "31495fdb9f84edbb7f67972746a1521456f649e2",
})]
def __init__(self, match):