ƒ^ƒOƒNƒ‰ƒEƒh

2008”N05ŒŽ06“ú

Radiant CMS‚ÅPerfumeƒuƒƒO‚ÌRSSƒtƒB[ƒh

Perfume‚̃IƒtƒBƒVƒƒƒ‹ƒuƒƒO‚ÍRSS‚ªo—Í‚³‚ê‚��‚Ü‚¹‚ñB“úXXV‚ðƒ`ƒFƒbƒN‚µ‚ɂ��‚­‚Ì‚àƒAƒ~ƒ…[ƒY‚ɂ�NŠè‚��‚·‚é‚Ì‚à–Ê“|‚¾‚Á‚½‚̂ŁAŽ©•ª‚̃T[ƒo‚ÅRSSƒtƒB[ƒh‚ðï¿½ï¿½ï¿½ï¿½E’ñ‹Ÿ‚·‚é‚悤‚É‚µ‚Ü‚µ‚½B
”zM‚·‚é‚̂̓^ƒCƒgƒ‹‚ÆURL‚݂̂ŁAƒtƒ@ƒ“ƒNƒ‰ƒu‰ïˆõŒÀ’èƒRƒ“ƒeƒ“ƒc‚Å‚ ‚é–{•ï¿½ï¿½‚Ì”zM‚͍s‚��‚Ü‚¹‚ñB

http://perfume.yurufuwa.jp/blog_feeds/


‚�}‚̃tƒB[ƒh‚́AƒI[ƒvƒ“ƒ\[ƒX‚ÌCMSuRadiant CMSv‚ƁARadiant CMS‚̃eƒ“ƒvƒŒ[ƒgã‚Å’¼ÚRubyƒR[ƒh‚ðŽÀs‚Å‚«‚é‚悤‚É‚·‚éƒGƒNƒXƒeƒ“ƒVƒ‡ƒ“uBack Doorv‚ðŽg‚Á‚��ï¿½ï¿½‚µ‚��‚Ü‚·B

http://www.radiantcms.org/
http://backdoor.rubyforge.org/


¡ˆ—‚̗��‚ê

  1. Radiant CMS‚ªRSSƒŠ[ƒ_[‚©‚ç‚ÌHTTPƒŠƒNƒGƒXƒg‚ðŽó‚¯AŠY“–‚·‚éƒeƒ“ƒvƒŒ[ƒg‚̏ˆ—‚ðŠJŽnB
  2. Back Door‚É‚æ‚èƒeƒ“ƒvƒŒ[ƒg“à‚ÌRubyƒR[ƒh‚ªŽÀs‚³‚ê‚éBƒIƒtƒBƒVƒƒƒ‹ƒuƒƒO‚ÌHTML‚ðŽæ“¾A•K—v‚ȏî•ñ‚ðØ‚èo‚µRSSï¿½ï¿½ï¿½ï¿½B
  3. Radiant CMS‚ªï¿½ï¿½ï¿½ï¿½‚³‚ꂽRSS‚ð•Ô‚·B


¡ŽÀ‘•
ƒƒŒƒCƒAƒEƒguXML Feedsvìï¿½ï¿½„
Content-type‚ðutext/xmlv‚Æ‚µ‚Ĉȉº‚Ì“à—e‚̃ŒƒCƒAƒEƒg‚ðìï¿½ï¿½‚µ‚Ü‚·B

<r:content />


ƒƒXƒjƒyƒbƒgutag_perfume_blog_feedv’è‹`„
ƒeƒ“ƒvƒŒ[ƒg’†‚Łuperfume_blog_feedv‚Ƃ��‚¤ƒ^ƒO‚ÅRSS‚ðï¿½ï¿½ï¿½ï¿½‚Å‚«‚é‚悤‚É‚µ‚Ü‚·Bƒ^ƒO‚É‚·‚é‚̂́A•¡”‚̃tƒB[ƒhi‚Ì‚Á‚¿A‚©‚µ‚ä‚©A‚ `‚¿‚á‚ñAƒXƒ^ƒbƒt‚ÌŠeƒuƒƒOj‚ðï¿½ï¿½ï¿½ï¿½‚·‚éÛ‚ÉRubyƒR[ƒh‚ðŽg‚��‰ñ‚¹‚é‚悤‚É‚·‚邽‚ß‚Å‚·B


<r:tag name="perfume_blog_feed">

require 'rubygems'
require 'hpricot'
require 'rss'
require 'open-uri'
require 'cgi'

FETCH_URL = tag.attr['url']
FEED_TITLE = tag.attr['title']
FEED_LINK = tag.attr['url']
FEED_DESCRIPTION = tag.attr['title']

# Žw’肳‚ꂽURL‚̃Rƒ“ƒeƒ“ƒc‚ðŽæ“¾‚µAString‚Æ‚µ‚Ä•Ô‚·B
def get_html(url)
result = ''
open(url) {|f| result = f.read}
end

# HTML‚©‚çblogƒGƒ“ƒgƒŠ[‚̃^ƒCƒgƒ‹AURLAXV“ú•t‚ðŽæ“¾‚µHash‚ÌArray‚Æ‚µ‚Ä•Ô‚·B
#
# Hash‚̃L[F :url => blogƒGƒ“ƒgƒŠ‚ÌURL, :title => ƒ^ƒCƒgƒ‹, :date => XV“ú•t
def extract_blog_entries(html)
result = []
doc = Hpricot(html)
doc.search("div.box_cont_01").search('h4').search('a').each do |e|
url = CGI::unescape(e['href'].sub(/.*set_ref__=http%3a%2f%2f/, "http://")).gsub(/&sid=[^&]*/, "")
date = Time.parse(e.search('span').inner_html.gsub(/\./, "/"))
title = CGI::unescapeHTML(e.inner_html.gsub(/<span.*/, ''))
result.push({:url => url, :title => title, :date => date})
end
return result
end

# extract_blog_entries‚Å–ß‚³‚ꂽî•ñ‚©‚çƒtƒB[ƒh‚ðï¿½ï¿½ï¿½ï¿½‚·‚é
def generate_feed(blog_entries)
rss = RSS::Maker.make("2.0") do |maker|
maker.channel.title = FEED_TITLE
maker.channel.link = FEED_LINK
maker.channel.description = FEED_DESCRIPTION

blog_entries.each do |entry|
item = maker.items.new_item
item.title = entry[:title]
item.link = entry[:url]
item.date = entry[:date]
item.dc_date = entry[:date]
end
end

result = rss.to_s
end


html = get_html(FETCH_URL)
if html != nil then
blog_entries = extract_blog_entries(html)
xml = generate_feed(blog_entries)
end
xml
</r:tag>


ƒRSSo—Í—pƒeƒ“ƒvƒŒ[ƒgìï¿½ï¿½„
ˆÈ‰º‚Ì“à—e‚̃eƒ“ƒvƒŒ[ƒg‚ðìï¿½ï¿½‚µ‚Ü‚·B‰º‹L‚Í‚ `‚¿‚á‚ñ‚̃uƒƒO(http://www.amuse.co.jp/perfume/blog/a-chan/)‚̃tƒB[ƒh‚Ì—á‚Å‚·B


<r:snippet name="tag_perfume_blog_feed" /><r:perfume_blog_feed url="http://www.amuse.co.jp/perfume/blog/a-chan/" title="Perfume A-CHAN BLOG" />


ƒeƒ“ƒvƒŒ[ƒg‚́uslugv‚ÍRSS‚Á‚Û‚­ua-chan.xmlv‚È‚Ç‚Æ‚µ‚Ü‚·BƒŒƒCƒAƒEƒg‚́A‘Oq‚̎菇‚ōìï¿½ï¿½‚µ‚½uXML Feedsv‚ð“K—p‚µ‚Ü‚·B

ˆÈã‚ÅŠ®—¹‚Å‚·B

ƒsƒNƒ`ƒƒ 4.png

Radiant CMS‚ł͈ê’莞ŠÔƒRƒ“ƒeƒ“ƒc‚ªƒLƒƒƒbƒVƒ…‚³‚ê‚Ü‚·BƒLƒƒƒbƒVƒ…‚ª—LŒø‚Å‚ ‚éŠÔ‚́A‰½“xƒAƒNƒZƒX‚µ‚Ä‚àŽÀÛ‚ɂ̓tƒB[ƒhï¿½ï¿½ï¿½ï¿½ˆ—‚͍s‚í‚ꂸƒLƒƒƒbƒVƒ…‚ªŽg—p‚³‚ê‚Ü‚·BHTMLŽæ“¾æ‚̃T[ƒo‚Ö‚Ì•‰‰ï¿½~‚ªŒyŒ¸‚³‚ê‚é‚̂ōD“s‡‚Å‚·B

Radiant CMS‚ŃŒƒXƒ|ƒ“ƒXƒLƒƒƒbƒVƒ…‚Ì—LŒøŠúŒÀ‚ð•ÏX‚·‚é:
http://vividtone.seesaa.net/article/94905361.html
ƒ‰ƒxƒ‹FPerfume Radiant CMS ruby RSS
posted by maeda at 12:10| “‡ª ☀| Comment(3) | TrackBack(0) | ƒ\ƒtƒgƒEƒFƒA | ‚}‚̃uƒƒO‚Ì“ÇŽÒ‚É‚È‚é | XVî•ñ‚ðƒ`ƒFƒbƒN‚·‚é
‚�}‚Ì‹LŽ–‚ւ̃Rƒƒ“ƒg
gucci ƒTƒ“ƒOƒ‰ƒX
Posted by ƒoƒbƒO ’Ê”Ì ƒuƒ‰ƒ“ƒh at 2013”N07ŒŽ22“ú 01:51
ƒoƒbƒO ƒŒƒfƒB[ƒX ”Ì”„ ŽžŒv http://www.advanceshopbonejp.biz/
Posted by ”Ì”„ ŽžŒv at 2013”N08ŒŽ01“ú 17:52
ŒC ”Ì”„
Posted by ƒrƒNƒgƒŠƒAƒV[ƒNƒŒƒbƒg ’Ê”Ì at 2013”N08ŒŽ09“ú 05:01
ƒRƒƒ“ƒg‚ð‘‚­
‚�N–¼‘O:

ƒ[ƒ‹ƒAƒhƒŒƒX:

ƒz[ƒ€ƒy[ƒWƒAƒhƒŒƒX:

ƒRƒƒ“ƒg:

”FØƒR[ƒh: [•K{“ü—Í]


¦‰æ‘œ‚Ì’†‚̕��Žš‚𔼊p‚Å“ü—Í‚µ‚Ä‚­‚¾‚³‚��B

‚�}‚Ì‹LŽ–‚ւ̃gƒ‰ƒbƒNƒoƒbƒN

L


‚�}‚̍L‚Í60“úˆÈãXV‚ª‚Ȃ��ƒuƒƒO‚É•\Ž¦‚ª‚³‚ê‚�N‚è‚Ü‚·B

ˆÈ‰º‚̂��‚¸‚ê‚©‚Ì•û–@‚Å”ñ•\Ž¦‚É‚·‚é‚�}‚Æ‚ª‰Â”\‚Å‚·B

E‹LŽ–‚Ì“ŠeA•ÒW‚ð‚�N‚�}‚È‚¤
Eƒ}ƒCƒuƒƒO‚́yÝ’èz „@yLÝ’èz ‚æ‚èAu60“úŠÔXV‚ª–³‚��ê‡v ‚Ì uL‚ð•\Ž¦‚µ‚Ȃ��v‚Ƀ`ƒFƒbƒN‚ð“ü‚ê‚ĕۑ��‚·‚éB