Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently May 18th, 2024, 1:42 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Reading a weather feed into an Opus pub -- source attached
PostPosted: May 16th, 2008, 2:31 am 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Opusscript can be used to extract information from XML/RSS feeds.
This pub will get the weather in your area (location, conditions, wind direction and speed and temperature). You can use Zipcodes if you live in the US; city codes that can be found at http://weather.yahoo.com/
If the pub finds a text file named loc.txt in the same folder containing the zip or area code, it will read that.

A few city code examples below

UKXX0209 is Banbury, UK
UKXX0061 is Glasgow, UK
UKXX0085 is London, UK

ASXX0089 is Perth, Aust
ASXX0016 is Brisbane, Aust
ASXX0112 is Sydney, Aust

New Zealand
NZXX0061 -- Palmerston North
NZXX0062 -- Paraparaumu

USNY0996 -- New York
USCA0987 -- San Francisco
USIL0225 -- Chicago
but in the USA it's easier to use your zipcode :-)

Paul


For this message Paul has been thanked by : mackavi


Last edited by Paul on July 21st, 2008, 4:25 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: May 16th, 2008, 3:08 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Very cool - I love weather gadgets.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: July 8th, 2008, 11:22 pm 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Here's the Opus Pro v6 source for the weather pub I posted previously. Basically the script follows these steps.

load the page with "InternetGetData()".

Split the page into lines with "split("\n")" and load each line into an array element.

Search each array element for relevant keywords using "String.contains" then use split again to extract the information required from each line.
I've displayed the original feed page to show how the data looks before it is extracted.
You can see the original feed contains more weather data if you want to extract it.
The principles used in this pub can be used on most RSS/XML feeds to update pubs from the web after publication.

paul


Attachments:
weather.zip [8.38 KiB]
Downloaded 1684 times


For this message Paul has been thanked by : mackavi


Last edited by Paul on August 15th, 2009, 11:57 am, edited 2 times in total.
Top
 Profile  
 
 Post subject:
PostPosted: July 9th, 2008, 8:04 am 
Offline

Joined: June 9th, 2008, 7:37 am
Posts: 79
Location: Kent, UK
Thanks for sharing the source Paul! Gratefully received.

Cheers, Kurt


For this message 3buns has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: July 9th, 2008, 10:57 am 
Offline

Joined: January 19th, 2005, 7:14 pm
Posts: 20
Location: Bromsgrove, Worcs, UK
Yes, thanks Paul.
Much appreciated.

Ken


For this message Ken Hubble has been thanked by : mackavi


Top
 Profile  
 
 Post subject: weather in your area
PostPosted: January 7th, 2009, 4:58 am 
Offline

Joined: April 5th, 2008, 2:41 pm
Posts: 102
Location: Sydney
Opus: Opus Pro Edition 9.51
OS: Windows 8.1
System: Acer Aspire V touch screen edition 4G RAM
WOW! MANY thanks - and a great way to learn more about remote accessing of date. :D

Many thanks!

_________________
Acer Aspire V touch
Opus Pro 9.51


For this message Viper4054 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 29th, 2010, 6:10 pm 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
Great code, thanks for posting. Nice to see some code pulling in XML feeds.


Thanks.

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


For this message lmc has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Reading a weather feed into an Opus pub -- source attach
PostPosted: January 3rd, 2014, 3:13 pm 
Offline

Joined: June 13th, 2006, 4:18 pm
Posts: 10
Location: Perth, Western Australia
Opus: 8.12 (V9 purchased but not yet installed)
OS: Windows 8.1 (64bit)
Hi all
Have been looking at this post and the script (thanks Paul). Not being familiar with XML I found it an excellent resource.
I know that this post is a couple of years old, however, during my travels in understanding this and looking at incorporating it into one of my pubs, found that the p parameter used in the yahoo feed will be replaced with a new w parameter. There will be a corresponding set of different city codes.

I have lifted the below examples from the yahoo page, although the current script still works fine, the script as supplied in the download example will need to be modified to reflect the new url and city code data.

To get the forecast for Yahoo! Headquarters in Sunnyvale, CA, use the WOEID code:
http://weather.yahooapis.com/forecastrss?w=2502265

To get the forecast for New York City, use the WOEID 2459115:
http://weather.yahooapis.com/forecastrss?w=2459115

To get the forecast for Paris, France, use the WOEID 615702:
http://weather.yahooapis.com/forecastrss?w=615702

To get the forecast for Paris, France, with degrees Celsius and other metric units:
http://weather.yahooapis.com/forecastrss?w=615702&u=c

_________________
Only Robinson Caruso had everything done by Friday


For this message rick@ifs has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group