This simple little code will just let you see if a URL is available on the Wayback Machine and automatically open the browser to the webpage if it does.
Code: (Select All)
Option Explicit
$NoPrefix
$Unstable:Http
$Console:Only
Title "Wayback Machine API"
ConsoleTitle "Enter Link"
Dim As String link
Do
Cls
Line Input "Link: ", link
Loop Until link <> ""
ConsoleTitle Title$ + " - " + link
link = "https://archive.org/wayback/available?url=" + link
Dim As Long hConn: hConn = OpenClient("HTTP:" + link)
If hConn < 0 And StatusCode(hConn) = 200 Then
Dim As String buf, json
Dim As Long length: length = LOF(hConn)
While Not EOF(hConn)
Get hConn, , buf
json = json + buf
Wend
Dim As String available: available = Mid$(json, InStr(json, Chr$(34) + "available" + Chr$(34) + ": ") + Len(Chr$(34) + "available" + Chr$(34) + ": "))
available = Mid$(available, 1, InStr(available, ",") - 1)
If available = "true" Then
Dim As String url
url = Mid$(json, InStrRev(json, Chr$(34) + "url" + Chr$(34) + ": ") + 8)
url = Mid$(url, 1, InStr(url, Chr$(34)) - 1)
Shell Hide DontWait "start " + url
Print "Opening in default browser..."
GoTo exiting
Else
Print "URL not available on the Wayback Machine"
GoTo exiting
End If
Close hConn
End If
exiting:
Dim As Long l: l = CsrLin
Dim As _Byte i
For i = 3 To 0 Step -1
Locate l, 0
Print "Exiting in"; i; "seconds..."
Sleep 1
Next
System
Schuwatch!
Yes, it's me. Now shut up.
Yes, it's me. Now shut up.