nie czytalem dokladnie ale jest tak ze na serwerze wwwa.accuweather.com jest wiekszosc miast ktorych gdzie indziej nie ma od szczawnicy po tarnobrzeg. tyle ze trzeba sobie zrobic template czy jak to nazywaja w spb weather dla tego konkretnie serwera.
przykladowo dla tarnobrzegu adres jest:
http://wwwa.accuweather.com/index-world-forecast.asp?zipcode=tarnobrzeg&submit=Go&partner=accuweatherprzy czym kod dla tego mista do wlasnie
tarnobrzeg.
jesli juz dodacie nowy template dla tego serwera nalezy dodac nowe misto np. tarnobrzeg i powiazac go z nowym serwerem oraz podac kod tego mista (w tym przypadku tarnobrzeg).
ponizej kod tego templata:
poczatek//
main
{
//version 2.0
//author: Shawn Lin
//remark: spb weather template for accuWeather.com
pointer weatherStart
{
go_start;
skip_to_text("<forecast>", false);
};
pointer weatherEnd
{
skip_to_text("</forecast>", false);
};
map skyMap
{
key_value("01", "1");
key_value("02", "2");
key_value("03", "3");
key_value("04", "3");
key_value("05", "6");
key_value("06", "4");
key_value("07", "4");
key_value("08", "5");
key_value("09", "0");
key_value("10", "0");
key_value("11", "6");
key_value("12", "7");
key_value("13", "7");
key_value("14", "14");
key_value("15", "13");
key_value("16", "13");
key_value("17", "15");
key_value("18", "8");
key_value("19", "10");
key_value("20", "16");
key_value("21", "16");
key_value("22", "11");
key_value("23", "10");
key_value("24", "12");
key_value("25", "11");
key_value("26", "8");
key_value("27", "0");
key_value("28", "0");
key_value("29", "9");
key_value("30", "1");
key_value("31", "0");
key_value("32", "0");
key_value("33", "17");
key_value("34", "17");
key_value("35", "18");
key_value("36", "19");
key_value("37", "20");
key_value("38", "20");
key_value("39", "21");
key_value("40", "22");
key_value("41", "27");
key_value("42", "29");
key_value("43", "30");
key_value("44", "25");
};
map dayMap
{
key_value(".", "0");
key_value("..", "1");
key_value("...", "2");
key_value("....", "3");
key_value(".....", "4");
key_value("......", "5");
key_value(".......", "6");
key_value("........", "7");
key_value(".........", "8");
key_value("..........", "9");
}
open_url("
http://forecastfox.accuweather.com/adcbin/forecastfox/weather_data.asp?metric=1&location=" + CityCode, "GET");
select_area(weatherStart, weatherEnd);
string tmprUnits = "C";
string windSpeedUnits = "m/s";
string pressureUnits = "mb";
string precipAmount = "cm";
string dayIndex = ".";
string skyDate;
string sky = ".";
while (sky)
{
sky = "";
skyDate = "<day number=\"" + dayMap[dayIndex] + "\">"
skip_to_text(skyDate, true);
//day of the month
skip_to_text("<obsdate>", true);
skip_to_text("/", true);
begin_var;
skip_chars("0-9");
string dayOfMonth = end_var;
//sky
skip_to_text("<weathericon>", true);
begin_var;
skip_chars("0-9");
sky = end_var;
//high temperature
skip_to_text("<hightemperature>", true);
begin_var;
skip_chars("0-9\\-");
string tmprHi = end_var;
//low temperature
skip_to_text("<lowtemperature>", true);
begin_var;
skip_chars("0-9\\-");
string tmprLo = end_var;
//wind speed
skip_to_text("<windspeed>", true);
begin_var;
skip_chars("0-9");
string windSpeed = end_var;
//wind direction
skip_to_text("<winddirection>", true);
begin_var;
skip_chars("A-Z");
string windDirection = end_var;
if (sky)
{
//tmprHi = sky
sky = skyMap[sky];
if (!sky)
{
sky = "0";
}
add_day;
}
dayIndex = dayIndex + ".";
}
open_url("
http://forecastfox.accuweather.com/adcbin/forecastfox/weather_data.asp?metric=1&location=" + CityCode, "GET");
select_area(weatherStart, weatherEnd);
sky = ".";
dayIndex = ".";
tmprUnits = "C";
windSpeedUnits = "m/s";
pressureUnits = "mb";
precipAmount = "cm";
while (sky)
{
string hour;
sky = "";
skyDate = "<day number=\"" + dayMap[dayIndex] + "\">"
skip_to_text(skyDate, true);
//day of the month
skip_to_text("<obsdate>", true);
skip_to_text("/", true);
begin_var;
skip_chars("0-9");
string dayOfMonth = end_var;
string daynight = "";
while (daynight $ "..")
{
if (!daynight)
{
hour = "12";
}
if (daynight)
{
hour = "23";
}
//sky
skip_to_text("<weathericon>", true);
begin_var;
skip_chars("0-9");
sky = end_var;
//high temperature
skip_to_text("<hightemperature>", true);
begin_var;
skip_chars("0-9\\-");
string tmprHi = end_var;
//low temperature
skip_to_text("<lowtemperature>", true);
begin_var;
skip_chars("0-9\\-");
string tmprLo = end_var;
//wind speed
skip_to_text("<windspeed>", true);
begin_var;
skip_chars("0-9");
string windSpeed = end_var;
//wind direction
skip_to_text("<winddirection>", true);
begin_var;
skip_chars("A-Z");
string windDirection = end_var;
if (sky)
{
//tmprHi = sky
sky = skyMap[sky];
if (!sky)
{
sky = "0";
}
add_day;
}
daynight = daynight + ".";
}
dayIndex = dayIndex + ".";
}
}
//koniec
nalezy wkleic (tylko kod bez wyrazw poczatek i koniec:) ) do pliku z rozszezeniem .tpl nazwa dowolna
potem dodac ten tpl w programiku
powodzenia