Sign in to follow this  
Followers 0
wakillon

Website Update

12 posts in this topic

I made this script for get the last update date of website

But I get same date for all !

#include <IE.au3>
#include <Date.au3>

ConsoleWrite ( "->--- Last Youtube Website UpDate Date : " & _GetLastWebsiteUpDateDate ( "http://www.youtube.com" ) & @Crlf )
ConsoleWrite ( "->--- Last Google Website UpDate Date : " & _GetLastWebsiteUpDateDate ( "http://www.google.fr/" ) & @Crlf )
ConsoleWrite ( "->--- Last AutoIt Website UpDate Date : " & _GetLastWebsiteUpDateDate ( "http://www.autoitscript.com/" ) & @Crlf )
ConsoleWrite ( "->--- Last Imageshack Website UpDate Date : " & _GetLastWebsiteUpDateDate ( "http://imageshack.us/" ) & @Crlf )
ConsoleWrite ( "->--- Last TV Underground Website UpDate Date : " & _GetLastWebsiteUpDateDate ( "http://tvu.org.ru/" ) & @Crlf )

Func _GetLastWebsiteUpDateDate ( $_Url )
    Local $_GetText=''
    $oIE = _IECreate ( $_Url, 0, 0, 1 )
    _IENavigate ( $oIE, "javascript:alert(document.lastModified)", 0 )
    Sleep ( 500 )
    WinWait ( 'Windows Internet Explorer', 'OK' )
    $_GetText = StringSplit ( StringStripWS ( StringReplace ( WinGetText ( 'Windows Internet Explorer', 'OK' ), 'ok', '' ), 7 ), ' ' )
    ControlClick ( 'Windows Internet Explorer', 'OK', 'Button1' )
    _IEQuit ( $oIE )
    Return $_GetText[1]
EndFunc ;==> _GetLastWebsiteUpDateDate ( )

->--- Last Youtube Website UpDate Date : 09/07/2010

->--- Last Google Website UpDate Date : 09/07/2010

->--- Last AutoIt Website UpDate Date : 09/07/2010

->--- Last Imageshack Website UpDate Date : 09/07/2010

->--- Last TV Underground Website UpDate Date : 09/07/2010

What I'm doing wrong ? Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites



You are picking websites that are updated every day, and using a stupid method to do it.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You are picking websites that are updated every day, and using a stupid method to do it.

Thank you for the "stupid" , it's a great help !

Another method ?

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Oi,

try something like this

#include <IE.au3>
#include <Date.au3>

Global $oIE = _IECreate("about:blank", 0, 0, 1)
ConsoleWrite("->--- Last Youtube Website UpDate Date : " & _GetLastWebsiteUpDateDate("http://www.youtube.com") & @CRLF)
ConsoleWrite("->--- Last Google Website UpDate Date : " & _GetLastWebsiteUpDateDate("http://www.google.fr/") & @CRLF)
ConsoleWrite("->--- Last AutoIt Website UpDate Date : " & _GetLastWebsiteUpDateDate("http://www.autoitscript.com/") & @CRLF)
ConsoleWrite("->--- Last Imageshack Website UpDate Date : " & _GetLastWebsiteUpDateDate("http://imageshack.us/") & @CRLF)
ConsoleWrite("->--- Last TV Underground Website UpDate Date : " & _GetLastWebsiteUpDateDate("http://tvu.org.ru/") & @CRLF)
_IEQuit($oIE)

Func _GetLastWebsiteUpDateDate($_Url)
    Local $sLastMod = ''
    _IENavigate($oIE, $_Url, 1)
    $sLastMod = $oIE.document.lastModified ; get the value directly ;)
    Return $sLastMod
EndFunc   ;==>_GetLastWebsiteUpDateDate

Share this post


Link to post
Share on other sites

Well... You should realise that through IE you have access to the document object, in the same way as javascript, so the javascript popup etc. is unnecessary ;)

I was hoping that by pointing out that the method is stupid you might have had a lightbulb moment. It's often the case that people stay with a rather dodgy method rather than search for the proper way. So yes, I was hoping it would be a great help :)

#include <IE.au3>

ConsoleWrite("->--- Last Youtube Website UpDate Date : " & _GetLastWebsiteUpDateDate("http://www.youtube.com") & @CRLF)
ConsoleWrite("->--- Last Google Website UpDate Date : " & _GetLastWebsiteUpDateDate("http://www.google.fr/") & @CRLF)
ConsoleWrite("->--- Last AutoIt Website UpDate Date : " & _GetLastWebsiteUpDateDate("http://www.autoitscript.com/") & @CRLF)
ConsoleWrite("->--- Last Imageshack Website UpDate Date : " & _GetLastWebsiteUpDateDate("http://imageshack.us/") & @CRLF)
ConsoleWrite("->--- Last TV Underground Website UpDate Date : " & _GetLastWebsiteUpDateDate("http://tvu.org.ru/") & @CRLF)

Func _GetLastWebsiteUpDateDate($_Url)
    Local $_GetText = ''

    $oIE = _IECreate($_Url, 0, 0, 1)

    $oDocument = _IEDocGetObj($oIE)
    $_GetText = $odocument.lastModified

    _IEQuit($oIE)

    Return $_GetText
EndFunc   ;==>_GetLastWebsiteUpDateDate

Do you now see how your method was not the correct way to try and do it? Initiating and then reading a popup from the screen, it's like using MouseClick and send when ControlSend is available.

Share this post


Link to post
Share on other sites

Thank you to both !

your methods are more elegant but give the same results...

Is there another method which gives realistic results for get update date of website ?

Unless it does not exists ? Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

There won't be a generic method, but each site will have ways for you to get it, probably by reading the source code or finding an element.

The reason is that the pages are generated on request server side, so they were created when you asked for the page (just now)

Share this post


Link to post
Share on other sites

The only way I have seen for doing this would be to use a program such as http://pageupdatechecker.mozdev.org/ which stays on the page and notifies you if it changed since you requested it (helpful to avoid refreshing while waiting for a change) Other than that, the only real way to see this would be to look at the upload date on "page.html" on the ftp for the website in question, however this is "usually" hidden from public view. There may be a way to use one of the many options google offers to check for change (it caches previous versions of page and that should be detectable) though it seems like a lot of extra work. Other than that, looking at the page there is no timestamp visible or hidden unless placed by the author so that would be impossible. Just some ideas for you to look into, perhaps if you had a specific thing you were looking for on one of those pages we could offer more help? What do you need to find changes for?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I just want find by differents way that a website is really down

and not demand if the server works !

you can have a working server and a nice 404 error page !

With a real update date it 'll be a decisive argument...

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Not necessarily. Any way to get an update date would be a little slow. maybe a small server crash. To tell if a server is down you would be better off doing a ping on the servers URL or IP address. If packets are lost, Its down.

The only thing ive seen to do this is

http://www.iwebtool.com/server_status

But without the code I can't tell how it works, or whether it is flawless.

Edited by Synct

Share this post


Link to post
Share on other sites

Not necessarily. Any way to get an update date would be a little slow. maybe a small server crash. To tell if a server is down you would be better off doing a ping on the servers URL or IP address. If packets are lost, Its down.

The only thing ive seen to do this is

http://www.iwebtool.com/server_status

But without the code I can't tell how it works, or whether it is flawless.

In most case the server works but website can be down ( error 40..., or all links dead, or no updates since a very long time )

but in less case website is up and server is out...

So get server state is not reliable and

So an update date could give more informations !


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

In most case the server works but website can be down ( error 40..., or all links dead, or no updates since a very long time )

but in less case website is up and server is out...

So get server state is not reliable and

So an update date could give more informations !

I argue that point because an update date just tells you when the .html file was last changed and uploaded to the server. The .html file may not change and a failed connection due to proxy/firewall/etc could cause it to not connect. The file remains on the server, your browser reads it and displays it. a 404 error tells you your browser can't find that page, whether its there or not is irrelevant. Heading off now but i will check back in the am

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0