It is currently March 28th, 2024, 4:59 pm

Change to Yahoo! weather feed

Release announcements and important news from the developers.
Post Reply
Horus
Posts: 1
Joined: April 14th, 2016, 8:05 am

Re: Change to Yahoo! weather feed

Post by Horus »

Hello all, I have managed to find the new URL for Yahoo weather

Code: Select all

https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid=2502265 AND u="f"
woeid is the same, your city code, and u also the same, temperature in f or c.

The main thing that has changed is the order of the "yweather:condition".

Old:

Code: Select all

<yweather:condition  text="Mostly Cloudy"  code="28"  temp="50"  date="Fri, 18 Dec 2009 9:38 am PST" />
New:

Code: Select all

<yweather:condition xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" code="27" date="Thu, 14 Apr 2016 12:00 AM PDT" temp="54" text="Mostly Cloudy"/>
The "text", "code", "temp" and "date" have been reshuffled, you just need to rearrange them in your measure as needed.
flipinho2005
Posts: 2
Joined: December 12th, 2013, 4:19 am

Re: Change to Yahoo! weather feed

Post by flipinho2005 »

Horus wrote:Hello all, I have managed to find the new URL for Yahoo weather

Code: Select all

https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid=2502265 AND u="f"
woeid is the same, your city code, and u also the same, temperature in f or c.

The main thing that has changed is the order of the "yweather:condition".

Old:

Code: Select all

<yweather:condition  text="Mostly Cloudy"  code="28"  temp="50"  date="Fri, 18 Dec 2009 9:38 am PST" />
New:

Code: Select all

<yweather:condition xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" code="27" date="Thu, 14 Apr 2016 12:00 AM PDT" temp="54" text="Mostly Cloudy"/>
The "text", "code", "temp" and "date" have been reshuffled, you just need to rearrange them in your measure as needed.
Below are the new measure settings using this YQL query for DINAJ 2

Code: Select all

;;====================================================
;;  Measures
;;====================================================
[mWeatherData]
 Measure=Plugin
 Plugin=WebParser
 URL=https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid=#location# AND u="#unit#"
 RegExp=(?siU).*distance="(.*)".*pressure="(.*)".*speed="(.*)".*temperature="(.*)".*chill="(.*)".*direction="(.*)".*speed="(.*)".*<item>.*<title>(.*)</title>.*temp="(.*)".*.*text="(.*)"
 UpdateRate=600
 ErrorString="DINAJ2: WebParser fail"
 ForceReload=1

[mWindUnit]
 Measure=Plugin
 Plugin=WebParser
 URL=[mWeatherData]
 StringIndex=3

[mTempUnit]
 Measure=Plugin
 Plugin=WebParser
 URL=[mWeatherData]
 StringIndex=4

[mChillTemp]
 Measure=Plugin
 Plugin=WebParser
 URL=[mWeatherData]
 StringIndex=5

[mWindDir]
 Measure=Plugin
 Plugin=WebParser
 URL=[mWeatherData]
 StringIndex=6

[mWindSpeed]
 Measure=Plugin
 Plugin=WebParser
 URL=[mWeatherData]
 StringIndex=7

[mLink]
 Measure=String
 String=https://weather.yahoo.com/country/state/city-#location#/

[mTemp]
 Measure=Plugin
 Plugin=WebParser
 URL=[mWeatherData]
 StringIndex=9

[mCond]
 Measure=Plugin
 Plugin=WebParser
 URL=[mWeatherData]
 StringIndex=10

[mTitle]
 Measure=Plugin
 Plugin=WebParser
 URL=[mWeatherData]
 StringIndex=8

[mStringScript]
 Measure=Script
 ScriptFile=dinaj.lua

;;====================================================
;;  Meters
;;====================================================
rootdrl
Posts: 3
Joined: April 14th, 2016, 9:42 pm

Re: Change to Yahoo! weather feed

Post by rootdrl »

-
Last edited by rootdrl on May 14th, 2016, 11:55 pm, edited 3 times in total.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Change to Yahoo! weather feed

Post by mak_kawa »

Thank you, Horus and flipinho2005, for providing updated information of Yahoo weather feed. I confirmed a new URL and produced RegExp string for 1 day forecast as...

RegExp="(?siU).*distance="(.*)".*pressure="(.*)".*speed="(.*)".*temperature="(.*)".*<title>(.*)</title>.*<lastBuildDate>(.*)</lastBuildDate>.*chill="(.*)".*direction="(.*)".*speed="(.*)".*humidity="(.*)".*pressure="(.*)".*rising="(.*)".*visibility="(.*)".*sunrise="(.*)".*sunset="(.*)".*_pos#">(.*)</geo:lat>.*_pos#">(.*)</geo:long>.*date="(.*)".*temp="(.*)".*text="(.*)".*date="(.*)".*high="(.*)".*low="(.*)".*text="(.*)".*date="(.*)".*high="(.*)".*low="(.*)".*text="(.*)".*"

This almost works well, but quite different from former xml.weather.yahoo feed. So it needs a many modifications in skin measure/meter. Sigh...
nagaraj
Posts: 1
Joined: April 15th, 2016, 6:00 am

Re: Change to Yahoo! weather feed

Post by nagaraj »

as u told i replaced it but then also its not working.. same error is coming.. pls help any one
Code is:

<?php
//Get the entire content for this zip code with temperature in Farhenheit unit
$result = file_get_contents('http://xml.weather.yahoo.com/forecastrss?w=INXX0012&u=c');
//interpret the xml string into an object
$xml = simplexml_load_string($result);

$xml->registerXPathNamespace('yweather', 'http://xml.weather.yahoo.com/ns/rss/1.0');
$location = $xml->channel->xpath('yweather:location');
//print_r ($location);
// Checks of data xml response from location
if (!empty($location)) {
// for loop for xml chnnael o response
foreach ($xml->channel->item as $item) {
$current = $item->xpath('yweather:condition');

$forecasts = $item->xpath('yweather:forecast');
$current = $current[0];

echo '<h1 style="margin-bottom: 0; font-size:12px;">Weather for</br> <span style="font-size:18px; font-weight:bold;"> ' . $location[0]['city'].','.$location[0]['country'] .'</span></h1>';
echo '<small>Today: '.$current["date"].'</small>';
echo '<h2 style="font-size:15px; ">Current Conditions: <span style="font-size:18px; font-weight:bold;">'.$current["temp"]. '&deg;C</span></h2>';
echo '<p><img src="http://l.yimg.com/a/i/us/we/52/'.$current["code"].'.gif"'.' style="vertical-align: middle; "/>&nbsp;'.$current["text"];
//end of if condition
}
//end of for each loop
}
echo '</p>';
?>
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Change to Yahoo! weather feed

Post by mak_kawa »

Sorry, forgot weather code.

RegExp="(?siU).*distance="(.*)".*pressure="(.*)".*speed="(.*)".*temperature="(.*)".*<title>(.*)</title>.*<lastBuildDate>(.*)</lastBuildDate>.*chill="(.*)".*direction="(.*)".*speed="(.*)".*humidity="(.*)".*pressure="(.*)".*rising="(.*)".*visibility="(.*)".*sunrise="(.*)".*sunset="(.*)".*_pos#">(.*)</geo:lat>.*_pos#">(.*)</geo:long>.*code="(.*)".*date="(.*)".*temp="(.*)".*text="(.*)".*code="(.*)".*date="(.*)".*high="(.*)".*low="(.*)".*text="(.*)".*code="(.*)".*date="(.*)".*high="(.*)".*low="(.*)".*text="(.*)".*"
Last edited by mak_kawa on April 15th, 2016, 12:57 pm, edited 1 time in total.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Change to Yahoo! weather feed

Post by mak_kawa »

Hi nagaraj

I don't know what your PHP code is. But URL description in your code ('http://xml.weather.yahoo.com/forecastrss?w=INXX0012&u=c') is not working anymore.

You should change it to the URL as Horus wrote.
artyom
Posts: 1
Joined: April 17th, 2016, 5:26 pm

Re: Change to Yahoo! weather feed

Post by artyom »

Here's the fixed YahooWeather.inc for Enigma users... seems to be working for now, but let me know if there are any problems.

Code: Select all

[MeasureYahooWeather]
Measure=Plugin
Plugin=WebParser
UpdateRate=1800
Url=https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid=#CurrentCode# AND u="#Unit#"
RegExp=(?siU).*distance="(.*)".*pressure="(.*)".*speed="(.*)".*temperature="(.*)".*city="(.*)".*country="(.*)".*region="(.*)".*chill="(.*)".*direction="(.*)".*speed="(.*)".*humidity="(.*)".*pressure="(.*)".*rising="(.*)".*visibility="(.*)".*sunrise="(.*)".*sunset="(.*)".*<title>.*:.*m .*(.*)</title>.*lat>(.*)<.*long>(.*)<.*condition.*code="(.*)".*temp="(.*)".*text="(.*)".*forecast.*day="(.*)".*code="(.*)".*high="(.*)".*low="(.*)".*text="(.*)".*forecast.*day="(.*)".*code="(.*)".*high="(.*)".*low="(.*)".*text="(.*)".*

;-----------------------
; UNITS

[MeasureWeatherUnitDistance]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=1

[MeasureWeatherUnitPressure]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=2

[MeasureWeatherUnitSpeed]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=3

[MeasureWeatherUnitTemp]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=4

;-----------------------
; LOCATION

[MeasureWeatherCity]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=5

[MeasureWeatherCountry]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=6

[MeasureWeatherRegion]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=7

;-----------------------
; WIND

[MeasureWeatherWindChill]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=8

[MeasureWeatherWindDirection]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=9

[MeasureWeatherWindDirectionCardinal]
Measure=Calc
Formula=FLOOR(((MeasureWeatherWindDirection/11.25)+1.5) < 33 ? ((MeasureWeatherWindDirection/11.25)+1.5) : ((MeasureWeatherWindDirection/11.25)+1.5)-32)
Substitute="10":"EbS","11":"ESE","12":"SEbE","13":"SE","14":"SEbS","15":"SSE","16":"SbE","17":"S","18":"SbW","19":"SSW","20":"SWbS","21":"SW","22":"SWbW","23":"WSW","24":"WbSW","25":"W","26":"WbN","27":"WNW","28":"NWbW","29":"NW","30":"NWbN","31":"NNW","32":"NbW","1":"N","2":"NbE","3":"NNE","4":"NEbN","5":"NE","6":"NEbE","7":"ENE","8":"EbN","9":"E"

[MeasureWeatherWindSpeed]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=10

;-----------------------
; ATMOSPHERE

[MeasureWeatherAtmoHumidity]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=11

[MeasureWeatherAtmoPressure]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=12

[MeasureWeatherAtmoRising]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=13

[MeasureWeatherAtmoVisibility]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=14

;--------------------------------
; SUN

[MeasureWeatherSunrise]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=15

[MeasureWeatherSunset]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=16

;--------------------------------
; REGION

[MeasureWeatherTimeZone]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=17

[MeasureWeatherLatitude]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=18

[MeasureWeatherLongitude]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=19

;--------------------------------
; CURRENT

[MeasureWeatherIcon]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=20

[MeasureWeatherTemp]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=21

[MeasureWeatherDesc]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=22

;-------------------------
; DAY 2

[MeasureWeatherDay2Date]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=23
Substitute="Sun":"Sunday","Mon":"Monday","Tue":"Tuesday","Wed":"Wednesday","Thu":"Thursday","Fri":"Friday","Sat":"Saturday"

[MeasureWeatherDay2Icon]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=24

[MeasureWeatherDay2High]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=25

[MeasureWeatherDay2Low]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=26

[MeasureWeatherDay2Average]
Measure=Calc
Formula=ROUND((MeasureWeatherDay2Low+MeasureWeatherDay2High)/2)

[MeasureWeatherDay2Desc]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=27

;-------------------------
; DAY 3

[MeasureWeatherDay3Date]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=28
Substitute="Sun":"Sunday","Mon":"Monday","Tue":"Tuesday","Wed":"Wednesday","Thu":"Thursday","Fri":"Friday","Sat":"Saturday"

[MeasureWeatherDay3Icon]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=29

[MeasureWeatherDay3High]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=30

[MeasureWeatherDay3Low]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=31

[MeasureWeatherDay3Average]
Measure=Calc
Formula=ROUND((MeasureWeatherDay3Low+MeasureWeatherDay3High)/2)

[MeasureWeatherDay3Desc]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=32

;-----------------------
; LOGO
; Yahoo! Weather requires that any application which uses their API include the Y!W logo and a link to their website. This section will automatically insert those elements into any skin which uses this measure module. Please do not remove these elements if you are redistributing this file with your own skin.

[YahooWeatherLogo]
Meter=IMAGE
MeterStyle=Style#Variant#Icon
Group=EnigmaMouseover
ImageName=#@#Images\MoxaWeather\Logo.png
H=25
W=25
Hidden=1
LeftMouseUpAction=["http://weather.yahoo.com/"][!Redraw]
ToolTipText=Powered by Yahoo! Weather.
User avatar
brinkeguthrie
Posts: 24
Joined: March 12th, 2016, 3:35 am

Re: Change to Yahoo! weather feed

Post by brinkeguthrie »

OK, my zip is 94518---where do I plug that in?
User avatar
brinkeguthrie
Posts: 24
Joined: March 12th, 2016, 3:35 am

Re: Change to Yahoo! weather feed

Post by brinkeguthrie »

I am partial to the Elegance skin: where do I put the new code in?

[Rainmeter]
Author=lilshizzy@gmail.com
Update=1000
@include=#SKINSPATH#Elegance\Variables\Fonts.inc

[Metadata]
Name=Elegance - Weather (sm3)
Config=
Description=
Instructions=The default weather code is set to Los Angeles, to get your Weather Code visit (weather.yahoo.com) type in your Zip, click the RSS button, your code will be in the address bar. Click on "Edit Skin" below to enter your code.
Version=1000
Tags=
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Variant=
Preview=

[Variables]
@include=#SKINSPATH#Elegance\Variables\Default.inc

[Styles]
@include=#SKINSPATH#Elegance\Variables\Styles.inc

;--------------------------------

[MeasureWeatherRSS]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1800
URL=http://xml.weather.yahoo.com/forecastrss?p=USCA0247&u=f
RegExp=(?siU)<link.*>(.*)</link>.*city=\"(.*)\".*sunrise=\"(.*)\".*sunset=\"(.*)\".*<image>.*<url>(.*)</url>.*<title>.*:.*m .*(.*)</title>.*lat>(.*)<.*long>(.*)<.*yweather:condition.*text=\"(.*)\".*code=\"(.*)\".*temp=\"(.*)\".*yweather:forecast.*day=\"(.*)\".*high=\"(.*)\".*code=\"(.*)\".*yweather:forecast.*day=\"(.*)\".*high=\"(.*)\".*code=\"(.*)\".*
StringIndex=1
; The default weather is set to Los Angeles (code=USCA1192), to get your Weather Code visit (weather.yahoo.com)
; type in your Zip Code, click the RSS button, your code will be in the address bar.
; At the end of the weather URL above you'll see "f" for Fahrenheit, change it to "c" for Celsius.

[MeasureWeatherDesc]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureWeatherRSS]
StringIndex=9

[MeasureWeatherTemp]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureWeatherRSS]
StringIndex=11

;--------------------------------

[Background]
Meter=IMAGE
ImageName=#SKINSPATH#Elegance\Images\weather_sm03.png
;SolidColor=255,0,0,100
X=0
Y=0
W=116
H=143

[Temp]
MeasureName=MeasureWeatherTemp
Meter=STRING
MeterStyle=normalwc
FontSize=73
X=60
Y=6

;[Temp2]
;Meter=STRING
;MeterStyle=normalwc
;FontSize=14
;X=-2r
;Y=93r
;Text="degrees"
Post Reply