Web scraping: Difference between revisions

Content added Content deleted
No edit summary
No edit summary
Line 823: Line 823:
<pre>
<pre>
Jul. 24, 01:38:23 AM EDT Eastern Time
Jul. 24, 01:38:23 AM EDT Eastern Time
</pre>

=={{header|Gambas}}==
<lang gambas>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</lang>
Output:
<pre>
Jun. 10, 15:22:25 UTC Universal Time
</pre>
</pre>