RosettaCodeData/Task/Web-scraping/Gambas/web-scraping.gambas
2023-07-01 13:44:08 -04:00

17 lines
885 B
Text

Public Sub Main()
Dim sWeb, sTemp, sOutput As String 'Variables
Shell "wget -O /tmp/web http://tycho.usno.navy.mil/cgi-bin/timer.pl" Wait 'Use 'wget' to save the web file in /tmp/
sWeb = File.Load("/tmp/web") 'Open file and store in sWeb
For Each sTemp In Split(sWeb, gb.NewLine) 'Split the file by NewLines..
If InStr(sTemp, "UTC") Then 'If the line contains "UTC" then..
sOutPut = sTemp 'Extract the line into sOutput
Break 'Get out of here
End If
Next
Print Mid(sOutput, 5) 'Print the result without the '<BR>' tag
End