lwwsx v0.1.2 Lwwsx View Source

Lwwsx is an Elixir SDK to talk with Livedoor Weather Web Service(LWWS) API.

Livedoor Weather Web Service(LWWS) gives a Japanese weather forecast.

For more details on API, refer to http://weather.livedoor.com/weather_hacks/webservice

Usage

Lwwsx.current(400030)

Lwwsx.current_text(400030)

Lwwsx.cities() |> Enum.random() |> elem(0) |> Lwwsx.current_text()

Link to this section Summary

Functions

show list of cities

get current weather forecast of city

get current weather forecast text of city

Link to this section Functions

show list of cities

For more details, refer to http://weather.livedoor.com/forecast/rss/primary_area.xml

Examples

iex> Lwwsx.cities()
[{"011000", "稚内"},
{"012010", "旭川"},
{"012020", "留萌"},
{"013010", "網走"},
{"013020", "北見"},
{"013030", "紋別"},
{"014010", "根室"},
{"014020", "釧路"},
{"014030", "帯広"},
{"015010", "室蘭"},
{"015020", "浦河"},
{"016010", "札幌"},
{"016020", "岩見沢"},
{"016030", "倶知安"},
{"017010", "函館"},
{"017020", "江差"},
{"020010", "青森"},
{"020020", "むつ"},
{"020030", "八戸"},
{"030010", "盛岡"},
{"030020", "宮古"},
{"030030", "大船渡"},
{"040010", "仙台"},
{"040020", "白石"},
{"050010", "秋田"},
{"050020", "横手"},
{"060010", "山形"},
{"060020", "米沢"},
{"060030", "酒田"},
{"060040", "新庄"},
{"070010", "福島"},
{"070020", "小名浜"},
{"070030", "若松"},
{"080010", "水戸"},
{"080020", "土浦"},
{"090010", "宇都宮"},
{"090020", "大田原"},
{"100010", "前橋"},
{"100020", "みなかみ"},
{"110010", "さいたま"},
{"110020", "熊谷"},
{"110030", "秩父"},
{"120010", "千葉"},
{"120020", "銚子"},
{"120030", "館山"},
{"130010", "東京"},
{"130020", "大島"},
{"130030", "八丈島"},
{"130040", "父島"},
{"140010", "横浜"},
{"140020", "小田原"},
{"150010", "新潟"},
{"150020", "長岡"},
{"150030", "高田"},
{"150040", "相川"},
{"160010", "富山"},
{"160020", "伏木"},
{"170010", "金沢"},
{"170020", "輪島"},
{"180010", "福井"},
{"180020", "敦賀"},
{"190010", "甲府"},
{"190020", "河口湖"},
{"200010", "長野"},
{"200020", "松本"},
{"200030", "飯田"},
{"210010", "岐阜"},
{"210020", "高山"},
{"220010", "静岡"},
{"220020", "網代"},
{"220030", "三島"},
{"220040", "浜松"},
{"230010", "名古屋"},
{"230020", "豊橋"},
{"240010", "津"},
{"240020", "尾鷲"},
{"250010", "大津"},
{"250020", "彦根"},
{"260010", "京都"},
{"260020", "舞鶴"},
{"270000", "大阪"},
{"280010", "神戸"},
{"280020", "豊岡"},
{"290010", "奈良"},
{"290020", "風屋"},
{"300010", "和歌山"},
{"300020", "潮岬"},
{"310010", "鳥取"},
{"310020", "米子"},
{"320010", "松江"},
{"320020", "浜田"},
{"320030", "西郷"},
{"330010", "岡山"},
{"330020", "津山"},
{"340010", "広島"},
{"340020", "庄原"},
{"350010", "下関"},
{"350020", "山口"},
{"350030", "柳井"},
{"350040", "萩"},
{"360010", "徳島"},
{"360020", "日和佐"},
{"370000", "高松"},
{"380010", "松山"},
{"380020", "新居浜"},
{"380030", "宇和島"},
{"390010", "高知"},
{"390020", "室戸岬"},
{"390030", "清水"},
{"400010", "福岡"},
{"400020", "八幡"},
{"400030", "飯塚"},
{"400040", "久留米"},
{"410010", "佐賀"},
{"410020", "伊万里"},
{"420010", "長崎"},
{"420020", "佐世保"},
{"420030", "厳原"},
{"420040", "福江"},
{"430010", "熊本"},
{"430020", "阿蘇乙姫"},
{"430030", "牛深"},
{"430040", "人吉"},
{"440010", "大分"},
{"440020", "中津"},
{"440030", "日田"},
{"440040", "佐伯"},
{"450010", "宮崎"},
{"450020", "延岡"},
{"450030", "都城"},
{"450040", "高千穂"},
{"460010", "鹿児島"},
{"460020", "鹿屋"},
{"460030", "種子島"},
{"460040", "名瀬"},
{"471010", "那覇"},
{"471020", "名護"},
{"471030", "久米島"},
{"472000", "南大東"},
{"473000", "宮古島"},
{"474010", "石垣島"},
{"474020", "与那国島"}]

get current weather forecast of city

Examples

iex> Lwwsx.current(400030)
{:ok,
%{
 "copyright" => %{
   "image" => %{
     "height" => 26,
     "link" => "http://weather.livedoor.com/",
     "title" => "livedoor 天気情報",
     "url" => "http://weather.livedoor.com/img/cmn/livedoor.gif",
     "width" => 118
   },
   "link" => "http://weather.livedoor.com/",
   "provider" => [
     %{"link" => "http://tenki.jp/", "name" => "日本気象協会"}
   ],
   "title" => "(C) LINE Corporation"
 },
 "description" => %{
   "publicTime" => "2019-12-07T10:36:00+0900",
   "text" => " 九州北部地方は、高気圧に覆われて晴れの所がありますが、気圧の谷や寒気の影響により概ね曇りで雨が降っている所があります。\n\n 7日の九州北部地方は、気圧の谷や寒気の影響により概ね曇りで雨が降る所がありますが、高気圧に覆われて次第に晴れとなるでしょう。\n\n 8日の九州北部地方は、寒気や湿った空気の影響により曇りとなる所がありますが、高気圧に覆われて概ね晴れとなるでしょう。\n\n 波の高さは、対馬海峡では、7日と8日は1.5メートルでしょう。九州西海上では、7日と8日は2メートルでしょう。豊後水道では、7日と8日は2メートルでしょう。\n 福岡県の内海では、7日と8日は0.5メートルでしょう。\n\n<天気変化等の留意点>\n 特記事項はありません。"
 },
 "forecasts" => [
   %{
     "date" => "2019-12-07",
     "dateLabel" => "今日",
     "image" => %{
       "height" => 31,
       "title" => "晴のち曇",
       "url" => "http://weather.livedoor.com/img/icon/5.gif",
       "width" => 50
     },
     "telop" => "晴のち曇",
     "temperature" => %{"max" => nil, "min" => nil}
   },
   %{
     "date" => "2019-12-08",
     "dateLabel" => "明日",
     "image" => %{
       "height" => 31,
       "title" => "曇のち晴",
       "url" => "http://weather.livedoor.com/img/icon/12.gif",
       "width" => 50
     },
     "telop" => "曇のち晴",
     "temperature" => %{
       "max" => %{"celsius" => "13", "fahrenheit" => "55.4"},
       "min" => %{"celsius" => "4", "fahrenheit" => "39.2"}
     }
   },
   %{
     "date" => "2019-12-09",
     "dateLabel" => "明後日",
     "image" => %{
       "height" => 31,
       "title" => "晴時々曇",
       "url" => "http://weather.livedoor.com/img/icon/2.gif",
       "width" => 50
     },
     "telop" => "晴時々曇",
     "temperature" => %{"max" => nil, "min" => nil}
   }
 ],
 "link" => "http://weather.livedoor.com/area/forecast/400030",
 "location" => %{
   "area" => "九州",
   "city" => "飯塚",
   "prefecture" => "福岡県"
 },
 "pinpointLocations" => [
   %{
     "link" => "http://weather.livedoor.com/area/forecast/4020400",
     "name" => "直方市"
   },
   %{
     "link" => "http://weather.livedoor.com/area/forecast/4020500",
     "name" => "飯塚市"
   },
   %{
     "link" => "http://weather.livedoor.com/area/forecast/4020600",
     "name" => "田川市"
   },
   %{
     "link" => "http://weather.livedoor.com/area/forecast/4022600",
     "name" => "宮若市"
   },
   %{
     "link" => "http://weather.livedoor.com/area/forecast/4022700",
     "name" => "嘉麻市"
   },
   %{
     "link" => "http://weather.livedoor.com/area/forecast/4040100",
     "name" => "小竹町"
   },
   %{
     "link" => "http://weather.livedoor.com/area/forecast/4040200",
     "name" => "鞍手町"
   },
   %{
     "link" => "http://weather.livedoor.com/area/forecast/4042100",
     "name" => "桂川町"
   },
   %{
     "link" => "http://weather.livedoor.com/area/forecast/4060100",
     "name" => "香春町"
   },
   %{
     "link" => "http://weather.livedoor.com/area/forecast/4060200",
     "name" => "添田町"
   },
   %{
     "link" => "http://weather.livedoor.com/area/forecast/4060400",
     "name" => "糸田町"
   },
   %{
     "link" => "http://weather.livedoor.com/area/forecast/4060500",
     "name" => "川崎町"
   },
   %{
     "link" => "http://weather.livedoor.com/area/forecast/4060800",
     "name" => "大任町"
   },
   %{
     "link" => "http://weather.livedoor.com/area/forecast/4060900",
     "name" => "赤村"
   },
   %{
     "link" => "http://weather.livedoor.com/area/forecast/4061000",
     "name" => "福智町"
   }
 ],
 "publicTime" => "2019-12-07T17:00:00+0900",
 "title" => "福岡県 飯塚 の天気"
}}

get current weather forecast text of city

Examples

iex> Lwwsx.current_text(400030)
{:ok,
 "九州北部地方は、高気圧に覆われて晴れの所がありますが、気圧の谷や寒気の影響により概ね曇りで雨が降っている所があります。\n\n 7日の九州北部地方は、気圧の谷や寒気の影響により概ね曇りで雨が降る所がありますが、高気圧に覆われて次第に晴れとなるでしょう。\n\n 8日の九州北部地方は、寒気や湿った空気の影響により曇りとなる所がありますが、高気圧に覆われて概ね晴れとなるでしょう。\n\n 波の高さは、対馬海峡では、7日と8日は1.5メートルでしょう。九州西海上では、7日と8日は2メートルでしょう。豊後水道では、7日と8日は2メートルでしょう。\n 福岡県の内海では、7日と8日は0.5メートルでしょう。\n\n<天気変化等の留意点>\n 特記事項はありません。"}

See Lwwsx.Api.forecast/1.