Skip to content
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

[Feature Request] Provide the Date/Time information from the "Last-Modified" HTTP header field as a fallback {date} keyword #858

Open
misc01 opened this issue Jun 26, 2020 · 1 comment

Comments

@misc01
Copy link

misc01 commented Jun 26, 2020

When a URL doesn't provide a {date} keyword, make the Date/Time information from the "Last-Modified" HTTP header field available as fallback {date} keyword.

gallery-dl -K https://i.redd.it/lz8ptshduw651.jpg
Keywords for directory names:
-----------------------------
category
  reddit
extension
  jpg
filename
  lz8ptshduw651
subcategory
  image

Keywords for filenames and --filter:
------------------------------------
category
  reddit
extension
  jpg
filename
  lz8ptshduw651
subcategory
  image
curl -s -v --head https://i.redd.it/lz8ptshduw651.jpg 2>&1 | grep '^< Last-Modified:'
< Last-Modified: Wed, 24 Jun 2020 19:35:27 GMT
gallery-dl -K https://dto9r5vaiz7bu.cloudfront.net/roh2exbd55ngr/source.png 
Keywords for directory names:
-----------------------------
category
  directlink
domain
  dto9r5vaiz7bu.cloudfront.net
extension
  png
filename
  source
fragment
  None
path
  roh2exbd55ngr
query
  None
subcategory


Keywords for filenames and --filter:
------------------------------------
category
  directlink
domain
  dto9r5vaiz7bu.cloudfront.net
extension
  png
filename
  source
fragment
  None
path
  roh2exbd55ngr
query
  None
subcategory
curl -s -v --head https://dto9r5vaiz7bu.cloudfront.net/roh2exbd55ngr/source.png 2>&1 | grep '^< Last-Modified:'
< Last-Modified: Mon, 20 Jan 2020 16:27:20 GMT
@mikf
Copy link
Owner

mikf commented Jun 27, 2020

Nice idea, but not easily doable with gallery-dl's current infrastructure, at least not in general. A filename usually gets built before starting an HTTP request to download it in order to potentially skip it altogether, so the Last Modified header would only be available when it's already too late.

There is currently an exception to this for missing filename extensions. Maybe I can extend this a bit an also use for date fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants