Gallery-dl: [question] DeviantArt: Formatting date for file name, downloading in date range

Created on 31 May 2019  路  1Comment  路  Source: mikf/gallery-dl

I spent too long trying to figure this out as a programming newbie so I figured I'd ask. How do you format the date from DeviantArt?

At the moment it's something like this:
{date} {title}.{extension}

That ends up looking like this:
%Y-%m-%d %H-%M-%S {title}.{extension}

I'd like the filename to look something like this:
%Y-%m-%d {title}.{extension}

Then use that to download files published between a date range. I know there is something for Reddit but not DeviantArt from what I've seen.

Thanks ahead of time.

question

Most helpful comment

Formatting datetime objects is described here: https://docs.python.org/3/library/string.html#format-examples (search for "date"). In short, you can put your date format string after the colon in your format string replacement field:
{date:%Y-%m-%d}

To only download files between a date range, you can use --filter and compare the date of each file against other datetime objects:
--filter "datetime(2015, 1, 1) <= date < datetime(2016, 1, 1)"
This will still extract all available files (i.e. it might take a while), but any file whose date is not between 2015-01-01 and 2016-01-01 will be silently ignored.

>All comments

Formatting datetime objects is described here: https://docs.python.org/3/library/string.html#format-examples (search for "date"). In short, you can put your date format string after the colon in your format string replacement field:
{date:%Y-%m-%d}

To only download files between a date range, you can use --filter and compare the date of each file against other datetime objects:
--filter "datetime(2015, 1, 1) <= date < datetime(2016, 1, 1)"
This will still extract all available files (i.e. it might take a while), but any file whose date is not between 2015-01-01 and 2016-01-01 will be silently ignored.

Was this page helpful?
0 / 5 - 0 ratings