「ねこふん」が終わったら「にゃらまち」
ねこふん
「猫ふんじゃったなギャラリーたち」と題して、主に大阪のギャラリー、カフェ、雑貨店が猫にまつわる企画を毎年 5月に開催している。通称「ねこふん」
2016年は 25の企画が行われた。 *1
私も 21の企画に足を運んだ。 *2
にゃらまち
「にゃらまち猫祭り」と題して、主にならまちの (ry
毎年 6月に開催している。
どうやって巡るか計画を立てるべく web サイトを見てみたが、ねこふん ほど情報が見やすくない。
営業時間と定休日が一覧で見たい。
とりあえずスクレイピングしてみたが……
require 'open-uri' require 'nokogiri' def detail xml h1 = xml.xpath('//h1').first return if h1.nil? eenc = Encoding::default_external opts = {replace: ''} shop = h1.text.encode(eenc, opts) keywd = '営業時間' srv = xml.xpath(%|//p[contains(text(), "#{keywd.encode('UTF-8', opts)}")]|) srv = srv.nil? ? '' : "%s:%s -- %s:%s" % (srv.text.scan(/\d+/) + %w[00 00 00 00]) # !> too many arguments for format string keywd = '定休日' hol = xml.xpath(%|//p[contains(text(), "#{keywd.encode('UTF-8', opts)}")]|) hol = hol.nil? ? '' : hol.text.encode(eenc, opts).strip.sub(/#{keywd}[ ::]*/, '') [shop, srv, hol] end def more(uri) opts = {invalid: :replace, undef: :replace, replace: ''} puts uri.encode(Encoding::default_external, opts) fn = uri.split(/\//).last + ".html" fn.encode!(Encoding::default_external, opts) open(fn, 'w'){|f| f.write(open(URI.encode(uri), &:read))} unless File.exist? fn xml = Nokogiri::XML(open(fn)) lm = xml.xpath('//a[contains(text(), "more")]') || [] lM = xml.xpath('//a[contains(text(), "More")]') || [] links = lm + lM links.map{|link| more(link.attributes['href'].value)} << detail(xml) end require 'pp' pp more("http://www.nyaramachi.com/shop-list/") # >> http://www.nyaramachi.com/shop-list/ # >> http://www.nyaramachi.com/shop-list/雑貨-ファッション/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/acartlifestyle/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/花羅古ろん/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/みに工房キャンバス/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/cloverand喫茶通圓/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/啓林堂書店奈良店/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/ことあかり洋品店/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/がまくち雑貨工房janji/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/doco-ao/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/ならまちわおん/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/necoco/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/猫雑貨ベゼル/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/marypoppinspochotte/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/器と郷土玩具瑜伽/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/アート-クラフトショップロビン/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/ab-cats/ # >> http://www.nyaramachi.com/ # >> http://www.nyaramachi.com/ # >> http://www.nyaramachi.com/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/猫雑貨とハンドメイドの店-cat-time/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/太古堂-ギャラリー-ショップ/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/アジアン雑貨-パーンファン/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/奈良のすごいタオル屋さん-ときどき猫/ # >> http://www.nyaramachi.com/shop-list/体験-1/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/着物あそびにっこり/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/美容室照美/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/遊悠工房zooandかぎひろ/ # >> http://www.nyaramachi.com/shop-list/カフェ-グルメ-1/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/うとうと/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/curryandcafe香炉里/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/四季折々の和菓子とらや/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/猫カフェ寧估庵/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/プティマルシェandぷちまるカフェ/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/franzkafkaフランツカフカ/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/喫茶工房まほろば/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/素人珈琲と雑貨よつばカフェ/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/若草カレー本舗/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/和彩rest紅絲/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/サブロク珈琲/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/甘いもん処-咲良/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/中華粥-穀雨/ # >> http://www.nyaramachi.com/shop-list/ギャラリー-1/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/ギャラリー一風/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/ギャルリサンク/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/スペース-プラス²/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/ # >> http://www.nyaramachi.com/shop-list/カフェ-ギャラリー-1/galleryandcafeならまち村/ # >> [[[["ACART LIFESTYLE", "11:00 -- 19:00", "月曜(祝日の場合は翌火曜)"]], # >> [nil], # >> [["ミニ工房きゃんばす", "10:30 -- 19:00", "火曜"]], # >> [["CLOVER&珈琲館通圓", "14:00 -- 23:00", "不定休"]], # >> [["啓林堂書店奈良店", "9:00 -- 21:00", "1月1日、2日"]], # >> [["ことあかり洋品店", "11:00 -- 17:00", "月曜、火曜"]], # >> [["がまくち雑貨工房janji", "11:17 -- 00:00", " 不定休"]], # >> [["doco*ao", "13:00 -- 18:00", "月曜、火曜"]], # >> [["ならまちわおん", "10:00 -- 18:00", "木曜"]], # >> [["necoco", "11:00 -- 18:00", "月曜、木曜 "]], # >> [["猫雑貨べセル", "10:00 -- 19:00", "月曜"]], # >> [["MaryPoppinsPochette", "10:30 -- 18:30", "木曜"]], # >> [["器と郷土玩具 瑜伽", "12:00 -- 18:00", "月曜"]], # >> [["アート&クラフトショップ ロビン", "11:00 -- 19:00", "木曜"]], # >> [["AB-CATS", "11:00 -- 18:00", "月&火曜"]], # >> [["にゃらまち猫祭り2016", "00:00 -- 00:00", ""]], # >> [["にゃらまち猫祭り2016", "00:00 -- 00:00", ""]], # >> [["にゃらまち猫祭り2016", "00:00 -- 00:00", ""]], # >> [nil], # >> [["太古堂", "13:00 -- 18:00", "月〜木曜 "]], # >> [["アジアン雑貨 パーンファン", "10:00 -- 19:00", " 木曜"]], # >> [["奈良のすごいタオル屋さんときどき猫", "11:00 -- 19:00", "不定休"]], # >> nil], # >> [[["着物あそび にっこり", "10:00 -- 00:00", "水曜 "]], # >> [["美容室照実", "9:00 -- 18:00", "火曜、第3水曜日"]], # >> [["遊悠工房 ZOO&かぎろひ", "11:00 -- 17:00", "火曜、水曜"]], # >> nil], # >> [[["うと○うと(にゃらまち美術館)", "11:00 -- 17:00", "不定休"]], # >> [["Curry&Cafe 香炉里", "11:00 -- 20:00", "火曜"]], # >> [["四季折々の和菓子 とらや", "9:00 -- 20:30", "火曜"]], # >> [["猫カフェ寧估庵", "00:00 -- 00:00", ""]], # >> [["プティ・マルシェ&ぷちまるカフェ〜", "00:00 -- 00:00", "月曜、火曜"]], # >> [["Franz KAFKA フランツ・カフカ", "11:00 -- 21:00", "水曜"]], # >> [["喫茶工房まほろば", "11:00 -- 17:00", "木曜"]], # >> [["素人珈琲と雑貨 よつばカフェ", "11:00 -- 19:00", "水曜日 営業時間:11:00~19:00"]], # >> [["若草カレー本舗", "11:30 -- 15:00", "水曜日夜"]], # >> [["和彩Rest紅絲", "11:00 -- 22:30", "火曜"]], # >> [["サブロク珈琲", "00:00 -- 00:00", ""]], # >> [["甘いもん処 咲良", "10:00 -- 18:00", "不定休"]], # >> [["中華粥 穀雨", "00:00 -- 00:00", ""]], # >> nil], # >> [[["ギャラリー一風", "00:00 -- 00:00", "水曜"]], # >> [["ギャルリ・サンク", "12:00 -- 19:00", "不定休(期間中)"]], # >> [["スペースプラス²", "00:00 -- 00:00", ""]], # >> nil], # >> [[["Gallery&Cafeならまち村", "11:00 -- 19:00", "火曜、水曜"]], nil], # >> ["Shop List", "00:00 -- 00:00", ""]]
力尽きた。
ページごとに構造がバラバラで Nokogiri 使うより、正規表現でゴリゴリやった方がよさそう。