File tree Expand file tree Collapse file tree
processing_app/topics/advanced_data Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77#
88
99attr_reader :zip , :weather , :temperature
10-
10+ WOEID = '12761335' # yahoos code for ZIP = '10003'
1111def setup
1212 sketch_title 'Yahoo Weather'
1313 @zip = 10_003
1414 font = create_font ( 'Times Roman' , 26 )
1515 # font = create_font('Merriweather-Light.ttf', 28)
1616 text_font ( font )
1717 # The URL for the XML document
18- url = format ( 'http://xml.weather.yahoo.com/forecastrss?p=%s' , zip )
18+
19+ fo = "http://query.yahooapis.com/v1/public/yql?format=xml&q=select+*+from+weather.forecast+where+woeid=%s+and+u='F'"
20+ url = format ( fo , WOEID )
1921 # Load the XML document
2022 xml = loadXML ( url )
2123 # Grab the element we want
22- forecast = xml . get_child ( 'channel' )
23- . get_child ( 'item' )
24- . get_child ( 'yweather:forecast' )
24+ forecast = xml . getChild ( "results/channel/item/yweather:forecast" ) ;
2525 # Get the attributes we want
2626 @temperature = forecast . get_int ( 'high' )
2727 @weather = forecast . get_string ( 'text' )
@@ -39,4 +39,3 @@ def draw
3939def settings
4040 size 600 , 360 , FX2D
4141end
42-
You can’t perform that action at this time.
0 commit comments