This is a memo for myself.
(Don't worry about the feed you're getting)
skeameba = feedparser.parse('http://rssblog.ameba.jp/ske48official/rss.html')
At this rate, Japanese is escaped
In [21]: skeameba['entries'][0]['title']
u'(\u5927\u77e2\u771f\u90a3)\u6709\u540d\u306a\u306e\u304b\u306a'
That's why Japanese display
def pp(obj):
pp = pprint.PrettyPrinter(indent=4, width=160)
str = pp.pformat(obj)
return re.sub(r"\\u([0-9a-f]{4})", lambda x unichr(int ("0x" + x.group(1), 16)), str)
Then it looks like this.
for entry in skeameba['entries']:
title = entry['title']
link = entry['link']
print "title:", pp(title) print "link: " , link
title: u'(Masana Oya)Is it famous'
link: http://ameblo.jp/ske48official/entry-11442256228.html
title: u'Churi =(((O ゜ ◇ ゜)o {Enjoy camera girls in 2013 ~!!!'
link: http://ameblo.jp/ske48official/entry-11442248464.html
title: u'First visit. (Flowers, з,) ~ ♪'
link: http://ameblo.jp/ske48official/entry-11442205471.html
title: u'Orange juice and rice balls(・ ∀ ・ >)'
link: http://ameblo.jp/ske48official/entry-11442174092.html
title: u'Furukawa(゜ ∀.*)Pochi'
link: http://ameblo.jp/ske48official/entry-11442139096.html
title: u'Oihi ~ * ♪(゜ ゜ summer)'
link: http://ameblo.jp/ske48official/entry-11442056727.html
title: u'Ogiso(・*・ A hideaway.)3 Shiori'
link: http://ameblo.jp/ske48official/entry-11442023303.html
title: u'Qin * At that moment'
link: http://ameblo.jp/ske48official/entry-11441959773.html
title: u'☆ Happy new year!!★KUMI'
link: http://ameblo.jp/ske48official/entry-11441813459.html
title: u'Lena(Hatsumode ・ ω ・ san)'
link: http://ameblo.jp/ske48official/entry-11441713875.html
Recommended Posts