Baidu (DB2312 エンコード) からの xml フィードを解析したいhttp://news.baidu.com/n?cmd=1&class=civilnews&tn=rss
私はいつもエラーが発生します
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 3, column 8
xml を Google フィードhttp://news.google.com/news?cf=all&ned=us&hl=en&topic=b&output=rssに変更すると、機能します。助言がありますか?
def get_feeds():
import sys
import xml.etree.ElementTree as etree
from urllib import urlopen
URL = "http://news.baidu.com/n?cmd=1&class=civilnews&tn=rss"
#URL = "http://news.google.com/news?cf=all&ned=us&hl=en&topic=b&output=rss"
tree = etree.parse(urlopen(URL))
if __name__ == '__main__':
get_feeds()