Jump to content

Recommended Posts

Posted

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

Posted (edited)

  On 9/7/2010 at 3:51 PM, 'Mat said:

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

Posted

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
Posted

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.

Posted

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

Posted

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)

Posted

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?

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

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
Posted

  On 9/11/2010 at 11:51 AM, 'Synct said:

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

Posted

  On 9/11/2010 at 12:05 PM, 'wakillon said:

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

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
  • Recently Browsing   0 members

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