1 ! Copyright (c) 2012 Anonymous
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: http.client io kernel math sequences ;
4 IN: rosetta-code.web-scraping
6 ! http://rosettacode.org/wiki/Web_scraping
8 ! Create a program that downloads the time from this URL:
9 ! http://tycho.usno.navy.mil/cgi-bin/timer.pl and then prints the
10 ! current UTC time by extracting just the UTC time from the web
13 ! If possible, only use libraries that come at no extra monetary
14 ! cost with the programming language and that are widely available
15 ! and popular such as CPAN for Perl or Boost for C++.
17 : web-scraping-main ( -- )
18 "http://tycho.usno.navy.mil/cgi-bin/timer.pl" http-get nip
19 [ "UTC" find-subseq [ 9 - ] [ 1 - ] bi ] keep subseq print ;
21 MAIN: web-scraping-main