Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -1,4 +1,4 @@
|
|||
---
|
||||
category:
|
||||
- Input_Output
|
||||
note: Networking
|
||||
note: Networking and Web Interaction
|
||||
|
|
|
|||
22
Task/Web-scraping/Julia/web-scraping-1.julia
Normal file
22
Task/Web-scraping/Julia/web-scraping-1.julia
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using Requests
|
||||
|
||||
function getusnotime()
|
||||
const url = "http://tycho.usno.navy.mil/timer.pl"
|
||||
s = try
|
||||
get(url)
|
||||
catch err
|
||||
@sprintf "get(%s)\n => %s" url err
|
||||
end
|
||||
isa(s, Requests.Response) || return (s, false)
|
||||
t = match(r"<BR>(.*UTC)", s.data)
|
||||
isa(t, RegexMatch) || return (@sprintf("raw html:\n %s", s.data), false)
|
||||
return (t.captures[1], true)
|
||||
end
|
||||
|
||||
(t, issuccess) = getusnotime()
|
||||
|
||||
if issuccess
|
||||
println("The USNO time is ", t)
|
||||
else
|
||||
println("Failed to fetch UNSO time:\n", t)
|
||||
end
|
||||
17
Task/Web-scraping/Julia/web-scraping-2.julia
Normal file
17
Task/Web-scraping/Julia/web-scraping-2.julia
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
Failed to fetch UNSO time:
|
||||
raw html:
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final"//EN>
|
||||
<html>
|
||||
<body>
|
||||
<TITLE>What time is it?</TITLE>
|
||||
<H2> US Naval Observatory Master Clock Time</H2> <H3><PRE>
|
||||
<BR>Apr. 20, 17:55:31 UTC Universal Time
|
||||
<BR>Apr. 20, 01:55:31 PM EDT Eastern Time
|
||||
<BR>Apr. 20, 12:55:31 PM CDT Central Time
|
||||
<BR>Apr. 20, 11:55:31 AM MDT Mountain Time
|
||||
<BR>Apr. 20, 10:55:31 AM PDT Pacific Time
|
||||
<BR>Apr. 20, 09:55:31 AM AKDT Alaska Time
|
||||
<BR>Apr. 20, 07:55:31 AM HAST Hawaii-Aleutian Time
|
||||
</PRE></H3><P><A HREF="http://www.usno.navy.mil"> US Naval Observatory</A>
|
||||
|
||||
</body></html>
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
use HTTP::Client; # http://github.com/carlins/http-client/
|
||||
use HTTP::Client; # https://github.com/supernovus/perl6-http-client/
|
||||
my $site = "http://tycho.usno.navy.mil/cgi-bin/timer.pl";
|
||||
HTTP::Client.new.get($site).match(/'<BR>'( .+? <ws> UTC )/)[0].say
|
||||
|
|
|
|||
29
Task/Web-scraping/VBScript/web-scraping.vb
Normal file
29
Task/Web-scraping/VBScript/web-scraping.vb
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
Function GetUTC()
|
||||
url = "http://tycho.usno.navy.mil/cgi-bin/timer.pl"
|
||||
With CreateObject("MSXML2.XMLHTTP.6.0")
|
||||
.open "GET", url, False
|
||||
.send
|
||||
arrt = Split(.responseText,vbLf)
|
||||
End With
|
||||
For Each t In arrt
|
||||
If InStr(t,"UTC") Then
|
||||
GetUTC = StripHttpTags(t)
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End Function
|
||||
|
||||
Function StripHttpTags(s)
|
||||
With New RegExp
|
||||
.Global = True
|
||||
.Pattern = "\<.+?\>"
|
||||
If .Test(s) Then
|
||||
StripHttpTags = .Replace(s,"")
|
||||
Else
|
||||
StripHttpTags = s
|
||||
End If
|
||||
End With
|
||||
End Function
|
||||
|
||||
WScript.StdOut.Write GetUTC
|
||||
WScript.StdOut.WriteLine
|
||||
Loading…
Add table
Add a link
Reference in a new issue