Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yahoo weather API, randomly returns old data?

I started using Yahoo's free weather API to get the weather data I need, but it seems each time I request a city weather data there is a chance that either I get updated data or old data from back to 1 to 8 days.

Here is a simple URL which I make my request with: Click here to see a sample request

The YQL query is simple, which requests the weather data for New York city:

select * from weather.forecast where woeid in (select woeid from geo.places(1) where text="New York")

But each time I refresh that URL, I might get a completely different result. for example I did refresh it right now a couple times (Now is 13th of November 2015, around 22:45 GMT time) and here are some results I got in the query.results.channel.item.condition.date part:

"date":"Fri, 13 Nov 2015 4:49 pm EST"
"date":"Thu, 12 Nov 2015 2:13 am EST"
"date":"Wed, 11 Nov 2015 1:49 am EST"
"date":"Fri, 13 Nov 2015 1:49 am EST"

This is very wired, how am I supposed to get current weather data like this when the API returns weather data for random dates each time I make a request?

Am I doing something wrong or missing something here?

Notes:

  • This behavior is same for many different cities which I tried.
  • Using same query in YQL Console doesn't seem to be having same problem. (YQL Console) (Actually same problem has been spotted there too)
  • Same thing is also happening on this XML/RSS request method as well: http://weather.yahooapis.com/forecastrss?w=2459115

Updates:

  • I did come across a case which returned me data from 8 days back!
  • Using SORT functions of YQL doesn't fix the problem, since the sort is applied after selecting requested record/records.
  • Today (25th of November 2015), I have tried more than 20 refreshes and seems the data returning is always correct, it seems the problem is fixed.

  • On 26th of November 2015 Yahoo announced that the problem is fixed: Thanks for your feedback. This issue has been fixed. Please check out the site again. If you are still having this problem, please post a new idea on this forum.

like image 374
Night2 Avatar asked Nov 13 '15 22:11

Night2


2 Answers

Yahoo dev's replied on twitter saying that they are investigating this issue. You can follow it up and upvote (for speeding the process) it here:

https://yahoo.uservoice.com/forums/207813/suggestions/10740099

like image 149
Zeuserich Avatar answered Sep 21 '22 16:09

Zeuserich


I have used the Yahoo Weather API XML format for years and noticed in that last couple of weeks this new bug. I tried to report the bug to https://developer.yahoo.com/weather/support but get a 404 page not found. I decided to parse the returned date if equal to current date to continue if not equal to re-call sub. this way I always get current weather but unfortunately that's a lot of unnecessary traffic / request maybe YDN will realize and fix. but without being able to report I don't know. I know this is not a fix but more a Band-Aid good luck!

Private Sub btnWeather_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWeather.Click

    If InternetConnection() = False Then
        MsgBox("No internet connection!", vbExclamation, "Oops!")
        Exit Sub
    Else

        'MsgBox("Internet connection detected!", vbInformation, "Huray!")

        btnWeather.Enabled = False
        lblWorking.Text = "Working ..."
        tbTries.Text = "1"

        Try

            Dim t As New clsWeather(Format(Me.TxtBoxZIP.Text), "f")
            lblTodaysDate.Text = FormatDateTime(Now.Date, DateFormat.ShortDate)
            tbHigh.Text = t.high & "°"
            lblCity.Text = TxtBoxZIP.Text & " Weather "
            tbLow.Text = t.Low & "°"
            tbDay.Text = t.day
            tbDate.Text = t.date1
            tbCurrenttemp.Text = t.currenttemp & "°"
            tbCurrentCode.Text = t.currentcode
            tbForcastCode.Text = t.ForcastCode
            tbSunrise.Text = t.Sunrise
            tbSunset.Text = t.Sunset
            tbWind.Text = CInt(Val(t.Wind)) & " mph"
            tbHumidity.Text = CInt(Val(t.humidity))
            imgWeather.Image = Image.FromFile(t.GetImage)
            CodeName()


            If t.currenttemp < 85 And t.currenttemp > 45 Then

                lblFeelsLike.Text = ""
                tbFeelsLike.Text = ""

            End If

            If t.currenttemp > 85 Then

                lblFeelsLike.Text = "Heat Index:"

                Dim Temp = t.currenttemp
                Dim RH = CInt(Val(t.humidity))

                tbFeelsLike.Text = (-42.379 + 2.04901523 * Temp) + (10.14333127 * RH) - (0.22475541 * Temp * RH) - (0.00683783 * Temp * Temp) - (0.05481717 * RH * RH) + (0.00122874 * Temp * Temp * RH) + (0.00085282 * Temp * RH * RH) - (0.00000199 * Temp * Temp * RH * RH)

                Dim num As Decimal = CType(tbFeelsLike.Text, Decimal)
                Me.tbFeelsLike.Text = String.Format("{0:n0}", num)
                tbFeelsLike.Text = tbFeelsLike.Text & "°"

            End If

            If t.currenttemp < 45 Then

                lblFeelsLike.Text = "Wind Chill:"
                tbFeelsLike.Text = CInt(Val(t.Chill)) & "°"

            End If


        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End If


        Dim day As String = DateTime.Now.ToString("dd")
        If day = tbDate.Text = True Then
            tbDate1.Text = tbDate.Text
            btnWeather.Enabled = True
            lblWorking.Text = ""
        Else
            btnWeather_Click(sender, e)
            tbTries.Text = tbTries.Text + 1
        End If


End Sub
like image 44
Jim Brown Avatar answered Sep 21 '22 16:09

Jim Brown