07-12-2023, 05:50 PM
I modified this program because I was bored today. Now it could work on Linux, however it assumes a web browser was "traditionally" installed as set via "Default Applications". Not from an AppImage and maybe not from Flatpak or Snaps.
This also works on Windows but the way to input has been changed.
Now in the first prompt it is only necessary to put down "qb64phoenix" (without double-quotation marks) instead of the whole shebang. Actually write "s.qb64phoenix" but I will tell you why a bit later.
There's a second prompt that asks which suffix to use. If you already put down a suffix on the first prompt then choose "none". If you don't see the one you want out of the ones listed then choose option #5 and enter it, the dot isn't necessary. For this example for this site choose option #1.
This should give you "https://qb64phoenix.com" if you did include the "s." at the front of the first prompt of this modified program.
In other words:
This is in case the site you're looking for is a rather old one or some other reason it cannot be upgraded by web browser to "secure" protocol.
On Linux the screen might act a bit funny while it counts down and then launches the web browser. Also be ready for when the web browser complains "archive-dot-org" itself isn't on "secure" protocol LOL because I had that happen to me while I was trying to test these modifications to look for a different site from decade-2000.
This also works on Windows but the way to input has been changed.
Now in the first prompt it is only necessary to put down "qb64phoenix" (without double-quotation marks) instead of the whole shebang. Actually write "s.qb64phoenix" but I will tell you why a bit later.
There's a second prompt that asks which suffix to use. If you already put down a suffix on the first prompt then choose "none". If you don't see the one you want out of the ones listed then choose option #5 and enter it, the dot isn't necessary. For this example for this site choose option #1.
This should give you "https://qb64phoenix.com" if you did include the "s." at the front of the first prompt of this modified program.
In other words:
Code: (Select All)
First prompt: Second prompt: Result:
s.qb64phoenix com https://qb64phoenix.com
qb64phoenix com http://qb64phoenix.com
s.freebasic net https://freebasic.net
s.freesound org https://freesound.org
s.dol other->gov https://dol.gov (U.S.A. Department of Labor)
s.kx77free.free.fr none https://kx77free.free.fr (Claudia Kalensky talented musician and music plug-in builder)
petesqbsite com http://petesqbsite.com
This is in case the site you're looking for is a rather old one or some other reason it cannot be upgraded by web browser to "secure" protocol.
On Linux the screen might act a bit funny while it counts down and then launches the web browser. Also be ready for when the web browser complains "archive-dot-org" itself isn't on "secure" protocol LOL because I had that happen to me while I was trying to test these modifications to look for a different site from decade-2000.
Code: (Select All)
'by Spriggsy
Option Explicit
$NoPrefix
$Unstable:Http
$Console:Only
Title "Wayback Machine API"
ConsoleTitle "Enter Link"
Dim As String link, ess, entry, dotwhat
'by mnrvovrfc: changed here so it's only necessary to put down the "fat part", and hint if the user prefers "secure" protocol
Cls
Line Input "Link: ", link
if link = "" then system
if lcase$(left$(link, 2)) = "s." then
ess = "s"
link = mid$(link, 3)
end if
print
print "What is the suffix?"
line input "(1) com; (2) org; (3) net; (4) none; (5) other:", entry
if entry = "" then system
if entry = "5" then
line input "Please enter the suffix:", dotwhat
if dotwhat = "" then system
if left$(dotwhat, 1) = "." then dotwhat = mid$(dotwhat$, 2)
elseif entry = "1" then
dotwhat = "com"
elseif entry = "2" then
dotwhat = "org"
elseif entry = "3" then
dotwhat = "net"
end if
link = "http" + ess + "://" + link
if entry <> "4" then link = link + "." + dotwhat
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)
$IF WIN THEN
Shell Hide DontWait "start " + url
$ELSE
Shell Hide DontWait "xdg-open " + url
$END IF
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