16
ちゃちゃまる 見習いデザインエンジニア 高校生 @chachmaru LIGブログの読者層を下げる

お天気スマホアプリはもう要らない。かも。

Embed Size (px)

Citation preview

Page 1: お天気スマホアプリはもう要らない。かも。

ちゃちゃまる

見習いデザインエンジニア

高校生

@chachmaru

LIGブログの読者層を下げる

Page 2: お天気スマホアプリはもう要らない。かも。

天気予報スマホアプリはもう遅い!(かも!)

Page 3: お天気スマホアプリはもう要らない。かも。
Page 4: お天気スマホアプリはもう要らない。かも。

Livedoor - Weather Hacks

"forecasts" : [ { "dateLabel" : "今日", "telop" : "晴のち曇", "date" : "2015-01-15", "temperature" : { "min" : null, "max" : { "celsius" : "11", "fahrenheit" : "51.8" } }, "image" : { "width" : 50, "url" : "http://weather.livedoor.com/img/icon/5.gif", "title" : "晴のち曇", "height" : 31 } }

Page 5: お天気スマホアプリはもう要らない。かも。

var http = require('http'); var url = 'http://weather.livedoor.com/forecast/webservice/json/v1?city=130010';

http.get(url, function(res) { var body = ''; res.setEncoding('utf8'); res.on('data', function(data) { body += data; }); res.on('end', function(data) { console.log(JSON.parse(body).forecasts[0].telop); }) });

Page 6: お天気スマホアプリはもう要らない。かも。

var url = 'http://weather.livedoor.com/forecast/webservice/json/v1?city=130010';

Page 7: お天気スマホアプリはもう要らない。かも。

var weather = '';

Page 8: お天気スマホアプリはもう要らない。かも。

http.get(url, function(res) {}

Page 9: お天気スマホアプリはもう要らない。かも。

res.setEncoding('utf8');

Page 10: お天気スマホアプリはもう要らない。かも。

res.on('data', function(data) {});

Page 11: お天気スマホアプリはもう要らない。かも。

var body = ''; res.on('data', function(data) { body += data; });

Page 12: お天気スマホアプリはもう要らない。かも。

"forecasts" : [ { "dateLabel" : "今日", "telop" : "晴のち曇", "date" : "2015-01-15", "temperature" : { "min" : null, "max" : { "celsius" : "11", "fahrenheit" : "51.8" } }, "image" : { "width" : 50, "url" : "http://weather.livedoor.com/img/icon/5.gif", "title" : "晴のち曇", "height" : 31 } }

Page 13: お天気スマホアプリはもう要らない。かも。

res.on('end', function(data) {}

Page 14: お天気スマホアプリはもう要らない。かも。

res.on('end', function(data) { var weather_data = JSON.parse(body); forecasts = weather_data['forecasts']; }

Page 15: お天気スマホアプリはもう要らない。かも。

res.on('end', function(data) { var weather_data = JSON.parse(body); forecasts = weather_data['forecasts']; for (index in forecasts) { forecast = forecasts[index]; if (forecast.dateLabel === '今日') { weather = forecast['telop']; console.log(weather); } } })

Page 16: お天気スマホアプリはもう要らない。かも。

IoTと連携

お天気スマホアプリはもう要らない。かも。