[TAG] Frappr

Benjamin A. Okopnik ben at linuxgazette.net
Tue Nov 1 21:02:01 MSK 2005


On Mon, Oct 31, 2005 at 12:58:59PM +0000, Jimmy O'Regan wrote:
> Rick Moen wrote:
> 
> >Quoting Benjamin A. Okopnik (ben at linuxgazette.net):
> >
> >
> >>I find myself travelling a lot, but often forgetting who's where (I was
> >>just in Chicago last week, and remembered, too late and with much
> >>chagrin, that Chris G. lives there.)
> >
> >
> >http://linuxmafia.com/~rick/ says:
> >ICBM: 122.19781??W, 37.43162??N, 27.4 metreslevation
> >(When you care enough to send the very best!)
> >
> >Feed that into xearth, and lo!
> 
> Hmm.
> 
> ===== SNIP HERE frappr.pl.txt =====
> #!/usr/bin/perl
> 
> while (<>)
> {
> 	# Yes, this is one long line.
> 	if 
> (/<tr><td><a\Whref="#"\WonClick="javascript:openMarker\(\d*,parseFloat\('([^']*)'\),parseFloat\('([^']*)'\)\);">(<img\Wsrc=([^ 
> ]*)[^>]*>)?<\/a><\/td><td><a\Whref="#"\WonClick="javascript:openMarker\(\d*,parseFloat\('\1'\),parseFloat\('\2'\)\);">([^<]*)<\/a><font 
> size=1>([^<]*)<\/font>,\W<font[^>]*>([^<]*)<\/font><br><font\Wsize=2>([^<]*)<\/font><\/td><\/tr>/)
> 	{
> 		my ($long, $lat, $img, $name, $address) = ($1, $2, $4, $5, 
> 		$6);
> 		print "$long $lat \"$name\"\n";
> 	}
> }
> ===== SNIP HERE =====
> 
> Pipe "lynx -source http://www.frappr.com/linuxgazette|frappr.pl" into 
> xearth, and see if it works (I don't have a copy to try it myself).

Didn't work for me, not sure why. I suspect that the long regex failed
somewhere. :(

``
#!/usr/bin/perl -wn
# Created by Ben Okopnik on Mon Oct 31 11:03:20 MST 2005

if (/openMarker/) {
	/.*Float..([\d.-]+).*?Float..([\d.-]+)/;
	printf "Lat: %12s Long: %12s  ", $1, $2;
	s/<.*?>//g;
	print
}
exit if /marker_status/
''

``
ben at Fenrir:/tmp$ lynx -source http://www.frappr.com/linuxgazette|./frappr
Lat:   -81.299917 Long:    29.865078   Ben Okopnik, Editor-in-Chief Saint Augustine (FL)
Lat:   -1.4157985 Long:   50.9169545  Thomas Adam Southampton, England (United Kingdom)
Lat:    -0.974663 Long:    51.455809   Pete Jewell Reading, England (United Kingdom)
Lat:     11.57346 Long:    50.936322   Karl-Heinz Herrmann Jena, Thuringia (Germany)
Lat:   -7.8210065 Long:   52.6826165   Jimmy O Regan Thurles, Tipperary North Riding (Ireland)
Lat:   -82.736602 Long:    27.821921   Jay R. Ashworth Saint Petersburg (FL)
Lat:  -76.7774515 Long:   38.9807345   Brian Bilbrey Bowie (MD)
Lat:   -0.2179705 Long:   51.9105095   Neil Youngman Stevenage, England (United Kingdom)
''


* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://linuxgazette.net *






More information about the TAG mailing list