The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: Re: Slightly OT: Scraping tide info for house intranet page



Gah, GMail's wrapped it. In the perl, the line starting
"print" and
the next line should be joined. Same with the "Net::" line in the
ruby.

ant

On Mon, May 26, 2008 at 2:35 AM, ant <blowback@xxxxxxx> wrote:
> here's a bit of perl that will do the job:
>
> #!/usr/bin/perl
> #
> use LWP::Simple;
>
> $url = "http://www.bbc.co.uk/weather/coast/tides/tides.shtml?date=20080527&loc=0027";;
> $start_delim = "<!-- tide chart stats open -->";
> $end_delim = "<!-- tide chart stats close -->";
>
> my $content = get $url;
>
> if(defined($content)) {
>    print "<table>\n$1\n</table>\n" if($content
=~
> /$start_delim(.*?)$end_delim/s);
> }
>
> Or some Ruby to do the same thing:
>
> #!/usr/bin/ruby
> require 'net/http'
>
> url = URI.parse("http://www.bbc.co.uk/weather/coast/tides/tides.shtml?date=20080527&loc=0027";)
> start_delim = "<!-- tide chart stats open -->"
> end_delim = "<!-- tide chart stats close -->"
>
> Net::HTTP.get(url).scan(/#{start_delim}(.*?)#{end_delim}/m) { x
> print "<table>\n#{x}</table>\n" }
>
>
>
> cheers
>
> ant
>
>
>
> On Sun, May 25, 2008 at 5:14 PM, Wayne <Wayne@xxxxxxx> wrote:
>> If your ok with a bit of coding - you could always hack it out in
real
>> time :)
>>
>> Wayne.
>>
>> James - SJ Computers wrote:
>>> You could use an iframe (Web Page inside another web page)
>>>
>>> http://www.w3schools.com/TAGS/tag_iframe.asp
>>>
>>> James
>>>
>>> On Sun, May 25, 2008 at 9:33 AM, noel_pilot <HA@xxxxxxx>
wrote:
>>>
>>>
>>>>   awesome good find, thanks, will prob use that altho
interested to know
>>>> how I could have scraped the other info if anyone
knows?!?!
>>>>
>>>> --- In ukha_d@xxxxxxx <ukha_d%40yahoogroups.com>,
"brougham Baker"
>>>> <bro-yahoo@...> wrote:
>>>>
>>>>> From: "noel_pilot" <HA@...>
>>>>>
>>>>>> Someone on here can hopefully help me, starting to
think about a home
>>>>>> intranet page with all useful stuff on there and
one think I like to
>>>>>> know is tides (i kitesurf as often as possible).
>>>>>>
>>>>>> Easiest source of information for this purpose I
think is the bbc,
>>>>>>
>>>>> There are other sources-
>>>>>
>>>> http://www.googleminiapps.com/tools/tides-gadget/
>>>>
>>>>> for e.g. That looks to have plain text output.
>>>>>
>>>>> My work mates also use the one on iGoogle homepage
too.
>>>>>
>>>>> Bro
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> [Non-text portions of this message have been removed]
>>>
>>>
>>> ------------------------------------
>>>
>>> **** Sponsored By http://www.Berble.com ****
>>> ****       Computers You Carry          ****
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>> ------------------------------------
>>
>> **** Sponsored By http://www.Berble.com ****
>> ****       Computers You Carry          ****
>>
>>
>>
>>
>>
>>
>

------------------------------------


UKHA_D Main Index | UKHA_D Thread Index | UKHA_D Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.