Jump to content

Website Update


wakillon
 Share

Recommended Posts

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

Link to comment
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
Link to comment
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.

Link to comment
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?

Link to comment
Share on other sites

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

Link to comment
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.

Edited by Synct
Link to comment
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

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...