• Welcome to TodayPlus Boards v2.
 

Weather Information Extract From Yahoo

Started by uk_skinner, February 03, 2005, 01:00:55 PM

Previous topic - Next topic

Broesel

Quote from: uk_skinnerbroesel:

  The weathertext for the night were from MSNBC since yahoo does not provide these information.  I did not find "Scattered Snow Showers" on the forecasttext.  So probably this is a new one.  
  But I can see code 157 and it should be "Snow".  Didn't you see it?

Yes, code 157 was not in my forecasttect.txt, went to yahoo.com and saw
it should mean snow. o.k. put it in my forecasttext.txt and shows "snow".
This code should be added to the translation in the php-script.

For the other code, I never saw a code 0 in any forecast, so I wonder
what that means (of course it showed Scattered Snow Showers on yahoo.com) ,
but not in the city.txt, There I got the code 0 (what was from msnbc.com
if I understand that right). So what shell I do with that code ? Adding it
in the forecasttext.txt with code 0,Not available (in German "nicht vorhanden") ?

Regards Broesel

uk_skinner

brosesel:

 The code 157 was in the PHP script but not code 0. I guess we can put as "Not available".  This is will only for the forecast text of current condition.

The codes you got from this.swFore in the city.txt are translated from the forecasttext.txt in your device.  So if you add the code 0 in your list that should be fine.

As I mentioned previously, the information on Yahoo are not enough to build the complete city.txt.  So the city.txt created by eemond's script is ,in fact, from two sources: MSNBC and Yahoo.  This could cause a problem if one of them is down.  We need come out an idea to see we can prevent this happened.

Broesel

Quote from: uk_skinner
As I mentioned previously, the information on Yahoo are not enough to build the complete city.txt.  So the city.txt created by eemond's script is ,in fact, from two sources: MSNBC and Yahoo.  This could cause a problem if one of them is down.  We need come out an idea to see we can prevent this happened.

Yes, that makes things clearer, because i got the same "forecast-codes"
from every source. :cool:

Thanks for the explanation :)
Broesel

Broesel

Another suggestion:

The third post in this thread from Zapme1 is talking about the php-script
to get weather-forecast-text in rss-format.

Shouldn't we put that in an own thread, so that we can discuss the
cityx.txt-things in this thread and the rss-forecast in another one?

What do you think ?

Regards Broesel

eemond

Broesel,

The way I return codes in the city1.txt files is as follows:

AM Codes - I search the attached table in the PHP Script for the weather text (Scattered Snow Showers). The Yahoo weather feed does not have codes, only descriptions. This table was the original US Forecasttext.txt file and had a 70-Sct Snow Showers which is not equal to Scattered Snow Showers. If not found, I return a 0, as you show above. When a 0 is found, I must change the PHP Script so Scattered Snow Showers can be found.

PM Codes - Yahoo does not provide a seperate AM/PM forecast, therefore, I just extract the PM Cods from the MSNBC feed.

With this understanding, I hope you can see that a 0 says that the PHP Script needs to be changed (Sct Snow Showers -> Scattered Snow Showers) and a non zero as in 157 means a change to your local Forecasttext.txt file.

Hope this helps.

Regards,
eemond

Broesel

Quote from: eemond
PM Codes - Yahoo does not provide a seperate AM/PM forecast, therefore, I just extract the PM Cods from the MSNBC feed.

With this understanding, I hope you can see that a 0 says that the PHP Script needs to be changed (Sct Snow Showers -> Scattered Snow Showers) and a non zero as in 157 means a change to your local Forecasttext.txt file.

Yes, of course I understand things better now :) Thanks for the explanation.
So, when we find a code "0", should we provide that to you ? And if so,
in what way ?

Thanks
Broesel

eemond

Broesel,

What you provoded was excellent. I need what you see in TP and what you see in Yahoo Weather.

Thanks...

Regards,
eemond

(I updated the PHP Script).

Broesel

@eemond and uk_skinner:

Had an other small bug yesterday:

When synching at 10 pm yesterday evening (with both yahoo and weather.com)
I got a forecast, where the dayicon from the first day was no dayicon
but a nighticon. So it shows a moon as dayicon.
Extract from city1.txt:


DayIcons:    29|30|5|14|11
DayTextes:   4|4|65|98|14

NichtIcons:   11|5|14|11|11
Nighttextes:  14|65|32|13|14


The first DayIcon is 29 what means "partly cloudy" but is a nighticon.

Can you please take a look at the script ?

Thanks Broesel

Broesel

Hmm, sorry, but there is another one :oops:


function makeWeatherObj() {



                       this.swCity = "Flensburg";

                       this.swSubDiv = "N/A";

                       this.swCountry = "Germany";

                       this.swRegion = "Europe";

                       this.swTemp = "44";

                       this.swTempCel = Math.round(5/9)*(this.swTemp-32);

                       this.swCIcon = "28";

                       this.swWindS = "11";

                       this.swWindD = "WNW";

                       this.swBaro = "29.89";

                       this.swHumid = "69";

                       this.swReal = "38";

                       this.swUV =  "0";

                       this.swVis = "Unlimited
</font></td>
<td>&nbsp;</td>
<td><font face=Arial size=2><b>Sunset:</b></font></td>
<td><font face=Arial size=2>
5:21 pm</font></td>
</tr></table>
<!--ENDMORE CC-->
<br>
<!--TEXT FORECAST HEADER-->
<a name="text"></a>
<table cellpadding=2 cellspacing=0 border=0 width=100%>
<tr valign=top><td width=49%>
<table cellpadding=2 cellspacing=0 border=0 width=100%>
<tr bgcolor=eeeeee><td><font face=Arial><b>Local Forecast</b></font> - <font size=1
face=Arial><a href="http://help.yahoo.com/help/us/weather/weather-21.html">(How to Read This)</a></font></td></tr></table>
<p>
<!--TEXT FORECAST-->
<font face="arial">
<p>
<b>Today:</b> Sun along with patchy clouds. High 42F. Winds W at 10 to 20 mph.<p>
<b>Tonight:</b> Rain showers early with precipitation turning to a";

                       this.swLastUp = "02/11/2005  1:00 pm CET";

                       this.swConText = "Früh Regen";

                       this.swFore = "6|7|1|2|3|02/11/2005|02/12/2005|02/13/2005|02/14/2005|02/15/2005
|30|5|14|14|11|4|94|271|84|13|42|40|26|23|35|0|90|90|30|60|5|16|14|4
5|11|65|90|84|16|14|24|22|16|19|30|";



                       this.swAcid = "GMXX0039";
}

http://todayplus.jhollin1138.com/rss/forecast_yahoo_txt.php?Citycode=GMXX0039&Language=GM

Regards Broesel

Edit: Attached the html-code from yahoo.com (rename to txt or htm from zip)

uk_skinner

ok, broesel (bug-finder).

I fixed the one on my server.  Try it.
eemond should take the one on TP forum.

Broesel

Quote from: uk_skinnerok, broesel (bug-finder).

I fixed the one on my server.  Try it.
eemond should take the one on TP forum.

Don't get the error with the text that not fits into the file, but is updatet
now. Having problems with where what script gets the data from :oops:

Hmm, wich one should I trust ?

Your script says "Früh Regen" what means Early Rain, Weather.com
says: Mostly Cloudy (this.swcontext)
Without translation, the script says "Mostly Cloudy" too.

Tryed your txt2.php

Edit: Here are the differences with and without translation:

this.swWindS = "9";
this.swWindS = "14";
this.swLastUp = "Feb 11 03:00 p.m. Local Time";
this.swLastUp = "11 Februar 2005 15:00";
this.swConText = "Mostly Cloudy";
this.swConText = "Früh Regen";

Tried with my homecity: GMXX0039

Regards Broesel

uk_skinner

That is odd.  The one you are testing is using information from weather.com.  If you remove the "Language=GM" from url, you will get non-translation and non-conversion city.txt.  And it said "Mostly Cloudy".  Let me check the translation in the PHP.

uk_skinner

Ok, found the problem.

In the forecasttext, there are two "Mostly Cloudy" in there, 3 and 74.  I changed the "74" to "Early Rain".  Please try again.

eemond

Broesel,

The first problem (DayIcon/NightIcon) was that a problem with this http://todayplus.jhollin1138.com/rss/forecast_yahoo_txt.php?Citycode=GMXX0039&Language=GM ?

DayIcons from this Script are pulled from here http://weather.yahoo.com/forecast/GMXX0039.html

When you said weather.com, is that UK's Script?

The second problem was a visibility in Yahoo weather of "Unlimited" (first time I saw that). If Yahoo Visibiity is "Unlimited" TP is "999". Is that OK?

Script has been updated.

Thanks...

Regards,
Ed

uk_skinner

eemond:

 Yes, I took care the testing script for weather.com.

 But the two "Mostly Cloudy" are in the yahoo PHP script too.  Can you take a look?

Thanks.