Last active
January 10, 2016 12:10
-
-
Save mono0x/5f68c5b5f9fbe6df8ca9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open-uri' | |
require 'json' | |
require 'date' | |
data = JSON.parse(open('http://www.puroland.jp/api/live/get_information/?category=event&page=1&count=20').read) | |
#data = JSON.parse(open('information.json').read) | |
items = data['data'].map {|item| | |
public_date = Date.new(*item['public_date'].split('/').map {|i| i.to_i(10) }) | |
m = item['title'].match(%r!\A(?:【(?<month>\d{1,2})/(?<day>\d{1,2}).+?】)?(?<title>.+)\z!) | |
date = if m && m[:month] | |
month = m[:month].to_i(10) | |
day = m[:day].to_i(10) | |
if public_date.month > month || (public_date.month == month && public_date.day >= day) | |
Date.new(public_date.year + 1, month, day) | |
else | |
Date.new(public_date.year, month, day) | |
end | |
else | |
public_date | |
end | |
{ | |
date: date, | |
title: m[:title], | |
url: item['url'], | |
updated_on: item['public_date'], | |
thumbnail_s: item['thumbnail_s'], | |
thumbnail_m: item['thumbnail_m'], | |
} | |
}.sort_by {|item| item[:date] } | |
items.each do |item| | |
p item[:date], item[:title] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#<Date: 2015-11-20 ((2457347j,0s,0n),+0s,2299161j)> | |
"【2015/6/27(土)~2016/1/12(火)まで開催中!】リトルツインスターズ40thアニバーサリーフェア" | |
#<Date: 2015-12-05 ((2457362j,0s,0n),+0s,2299161j)> | |
"25thアニバーサリーイヤー Miracle Gift Paradeに、はいだしょうこさんがゲスト声優として出演決定!" | |
#<Date: 2015-12-15 ((2457372j,0s,0n),+0s,2299161j)> | |
"チャレンジ!マイメロディ『アリオ10周年イメージアンバサダー荒川静香さんとマイメロディのスケート共演』の様子を動画でチェック!" | |
#<Date: 2016-01-09 ((2457397j,0s,0n),+0s,2299161j)> | |
"マイメロディのキャラレジ" | |
#<Date: 2016-01-10 ((2457398j,0s,0n),+0s,2299161j)> | |
"アフタートーク実施決定!朗読劇「生田さんちのこめ王子」" | |
#<Date: 2016-01-12 ((2457400j,0s,0n),+0s,2299161j)> | |
"マイメロディ40thアニバーサリーフェア情報更新しました♪" | |
#<Date: 2016-01-16 ((2457404j,0s,0n),+0s,2299161j)> | |
"マイメロディのバースデーパーティ" | |
#<Date: 2016-01-31 ((2457419j,0s,0n),+0s,2299161j)> | |
"鎖音プロジェクトのゲスト出演が決定!! one’s wishes-D 1周年記念ライブ開催" | |
#<Date: 2016-02-06 ((2457425j,0s,0n),+0s,2299161j)> | |
"ちっちゃな英雄(ヒーロー)Valentaine Event" | |
#<Date: 2016-02-07 ((2457426j,0s,0n),+0s,2299161j)> | |
"「ハローキティとあそぼうBRAVO!!」公演直前スペシャルステージ" | |
#<Date: 2016-02-13 ((2457432j,0s,0n),+0s,2299161j)> | |
"iDOL Street~超絶 バレンタイン~ in Sanrio Puroland" | |
#<Date: 2016-02-14 ((2457433j,0s,0n),+0s,2299161j)> | |
"チェキ会開催決定!樋口裕太スペシャルイベント 出演キャラクターが決定しました!" | |
#<Date: 2016-02-27 ((2457446j,0s,0n),+0s,2299161j)> | |
"ぽちゃっこのバースデーパーティー" | |
#<Date: 2016-02-29 ((2457448j,0s,0n),+0s,2299161j)> | |
"ぽちゃっこのバースデーパーティー スペシャル" | |
#<Date: 2016-03-11 ((2457459j,0s,0n),+0s,2299161j)> | |
"動画を公開したよ♪ ポムポムプリン20周年記念イベント" | |
#<Date: 2016-03-19 ((2457467j,0s,0n),+0s,2299161j)> | |
"KiRAKIRAGIRLSオーディション" | |
#<Date: 2016-03-19 ((2457467j,0s,0n),+0s,2299161j)> | |
"それいけ! ハローキティアンダーバーランド大冒険" | |
#<Date: 2016-03-21 ((2457469j,0s,0n),+0s,2299161j)> | |
"(仮)劇団乙女新党×ハローキティミュージカル公演" | |
#<Date: 2016-04-02 ((2457481j,0s,0n),+0s,2299161j)> | |
"D 13th Anniversary Special Premium Live 2016" | |
#<Date: 2016-04-16 ((2457495j,0s,0n),+0s,2299161j)> | |
"詳細情報公開!!こすぷれふぇすた5 in サンリオピューロランド25th" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment