Line 0
Link Here
|
|
|
1 |
--- libmateweather/weather-metar.c.orig 2016-08-29 15:53:19 UTC |
2 |
+++ libmateweather/weather-metar.c |
3 |
@@ -510,7 +510,7 @@ metar_finish (SoupSession *session, Soup |
4 |
|
5 |
loc = info->location; |
6 |
|
7 |
- searchkey = g_strdup_printf ("\n%s", loc->code); |
8 |
+ searchkey = g_strdup_printf ("<raw_text>%s", loc->code); |
9 |
p = strstr (msg->response_body->data, searchkey); |
10 |
g_free (searchkey); |
11 |
if (p) { |
12 |
@@ -522,8 +522,8 @@ metar_finish (SoupSession *session, Soup |
13 |
metar = g_strdup (p); |
14 |
success = metar_parse (metar, info); |
15 |
g_free (metar); |
16 |
- } else if (!strstr (msg->response_body->data, "National Weather Service")) { |
17 |
- /* The response doesn't even seem to have come from NWS... |
18 |
+ } else if (!strstr (msg->response_body->data, "aviationweather.gov")) { |
19 |
+ /* The response doesn't even seem to have come from NOAA... |
20 |
* most likely it is a wifi hotspot login page. Call that a |
21 |
* network error. |
22 |
*/ |
23 |
@@ -550,8 +550,14 @@ metar_start_open (WeatherInfo *info) |
24 |
} |
25 |
|
26 |
msg = soup_form_request_new ( |
27 |
- "GET", "http://weather.noaa.gov/mgetmetar.php", |
28 |
- "cccc", loc->code, |
29 |
+ "GET", "https://www.aviationweather.gov/adds/dataserver_current/httpparam", |
30 |
+ "dataSource", "metars", |
31 |
+ "requestType", "retrieve", |
32 |
+ "format", "xml", |
33 |
+ "hoursBeforeNow", "3", |
34 |
+ "mostRecent", "true", |
35 |
+ "fields", "raw_text", |
36 |
+ "stationString", loc->code, |
37 |
NULL); |
38 |
soup_session_queue_message (info->session, msg, metar_finish, info); |
39 |
|