def getDanmu(cid):
if not cid:
return "?????"
try:
cid_url = "http://comment.bilibili.com/%s.xml" % cid
danmu_xml = urllib.request.urlopen(cid_url).read()
xml = zlib.decompressobj(-zlib.MAX_WBITS).decompress(danmu_xml).decode() # ????????
return xml # ?????
except Exception:
pass
# ??xml??????????????
评论列表
文章目录