Archive-dot-org simple helper
#7
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.
Reply


Messages In This Thread
Archive-dot-org simple helper - by mnrvovrfc - 07-06-2023, 10:39 PM
RE: Archive-dot-org simple helper - by grymmjack - 07-09-2023, 04:15 PM
RE: Archive-dot-org simple helper - by grymmjack - 07-09-2023, 04:16 PM
RE: Archive-dot-org simple helper - by mnrvovrfc - 07-09-2023, 06:38 PM
RE: Archive-dot-org simple helper - by grymmjack - 07-09-2023, 04:18 PM
RE: Archive-dot-org simple helper - by Ultraman - 07-10-2023, 11:11 AM
RE: Archive-dot-org simple helper - by Ultraman - 07-10-2023, 11:35 AM
RE: Archive-dot-org simple helper - by mnrvovrfc - 07-10-2023, 03:39 PM
RE: Archive-dot-org simple helper - by Ultraman - 07-10-2023, 04:51 PM
RE: Archive-dot-org simple helper - by mnrvovrfc - 07-12-2023, 05:50 PM
RE: Archive-dot-org simple helper - by grymmjack - 07-14-2023, 12:43 AM



Users browsing this thread: 5 Guest(s)