urls: get date modified Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

urls: get date modified

17 Sep 2017, 11:04

I would like to be able to get the date modified for a url, e.g.:
v2-changes
https://autohotkey.com/v2/v2-changes.htm

The InternetFileGetTime function returns:
Sun, 20 Sep 2015 22:21:47 GMT (20150920222147)
however, the content has definitely been modified this year, clear from some of the newer material.
InternetFileGetTime() - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=1252

NirSoft IECacheView gives the date:
16/06/2017 09:54:15
which is plausible.
Compare with:
AutoHotkey v2 alpha (UPDATES) - Page 2 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 55#p159655

Any ideas would be welcome. Thanks for reading.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
qwerty12
Posts: 468
Joined: 04 Mar 2016, 04:33
Contact:

Re: urls: get date modified  Topic is solved

17 Sep 2017, 13:46

jeeswg wrote:The InternetFileGetTime function returns:
Sun, 20 Sep 2015 22:21:47 GMT (20150920222147)
however, the content has definitely been modified this year, clear from some of the newer material.
InternetFileGetTime() - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=1252
In InternetFileGetTime(), if you change try WebRequest.Open( "HEAD", URL ) to try WebRequest.Open( "GET", URL ) it will do what you want. Sadly, I think the page gets downloaded now in its entirety, but I don't know anything about the Internet to be able to give you a better solution.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: urls: get date modified

17 Sep 2017, 13:57

Cheers, that's amazing, I hardly ever want to do this, so it doesn't really matter if I have to download the whole webpage. Interesting that all it took was to change HEAD to GET, I wonder how you figured that out.

Btw based on here:
download urls to vars, partially/fully, via WinHttpRequest - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 09#p168409

This appeared to work, to avoid unnecessarily downloading data:

Code: Select all

WebRequest.SetRequestHeader("Range", "bytes=0-0")
I made your change, and added the Range line, and I did retrieve the correct date. It also appeared to prevent the downloading of data, confirmed by adding this line:

Code: Select all

MsgBox, % WebRequest.ResponseBody.MaxIndex()
Hmm, why the difference in dates, what does it signify? Created/modified? Something else?

I'll mark this as solved, although any other ideas would be most welcome.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
qwerty12
Posts: 468
Joined: 04 Mar 2016, 04:33
Contact:

Re: urls: get date modified

18 Sep 2017, 02:37

jeeswg wrote:Interesting that all it took was to change HEAD to GET, I wonder how you figured that out.
Luck :-) I had a snippet involving the WebRequest object from somewhere else and I noticed that was giving me a more recent date.
This appeared to work, to avoid unnecessarily downloading data:

Code: Select all

WebRequest.SetRequestHeader("Range", "bytes=0-0")
I made your change, and added the Range line, and I did retrieve the correct date. It also appeared to prevent the downloading of data, confirmed by adding this line:

Code: Select all

MsgBox, % WebRequest.ResponseBody.MaxIndex()
That's a nice solution. I guess for servers that support it (which, thankfully, in 2017 is most of them) that makes using GET not so bad.
Hmm, why the difference in dates, what does it signify? Created/modified? Something else?
It could be a Cloudflare thing, maybe?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Aleque, BPet, Chunjee, Rohwedder, RussF and 113 guests