Freezethewind / -XML-Reader-Lofter-Data-Backup

XML readers for xml files of LOFTER users data
57 stars 4 forks source link

评论区最多只显示一个评论 #1

Open shutongX opened 4 years ago

shutongX commented 4 years ago

原因在于遍历的应该是comment子节点,而不是commentList节点 女票叫我来修BUG,我来了 作者有空的话更新一下就好

cList = item.getElementsByTagName("commentList")
    if (len(cList) > 0) :
        comList = cList[0].getElementsByTagName('comment')
        comments = []
        for comm in comList:
            pubid = comm.getElementsByTagName("publisherUserId")[0].childNodes[0].data
            pubnick = comm.getElementsByTagName("publisherNick")[0].childNodes[0].data
            comcon = comm.getElementsByTagName("content")[0].childNodes[0].data
            comtime = comm.getElementsByTagName("publishTime")[0].childNodes[0].data
            repid = comm.getElementsByTagName("replyToUserId")[0].childNodes[0].data
            comments.append({"pubid":pubid, "pubnick":pubnick, "comcon":comcon, "comtime":comtime, "repid":repid})
    else :
        comments = []``
Freezethewind commented 4 years ago

谢谢!这个问题我刚才已经改完了,稍后改完其他问题后就会更新的

---原始邮件--- 发件人: "谢子昆"<notifications@github.com> 发送时间: 2020年6月12日(周五) 晚上11:39 收件人: "Freezethewind/-XML-Reader-Lofter-Data-Backup"<-XML-Reader-Lofter-Data-Backup@noreply.github.com>; 抄送: "Subscribed"<subscribed@noreply.github.com>; 主题: [Freezethewind/-XML-Reader-Lofter-Data-Backup] 评论区最多只显示一个评论 (#1)

原因在于遍历的应该是comment子节点,而不是commentList节点 女票叫我来修BUG,我来了 作者有空的话更新一下就好 cList = item.getElementsByTagName("commentList") if (len(cList) > 0) : comList = cList[0].getElementsByTagName('comment') comments = [] for comm in comList: pubid = comm.getElementsByTagName("publisherUserId")[0].childNodes[0].data pubnick = comm.getElementsByTagName("publisherNick")[0].childNodes[0].data comcon = comm.getElementsByTagName("content")[0].childNodes[0].data comtime = comm.getElementsByTagName("publishTime")[0].childNodes[0].data repid = comm.getElementsByTagName("replyToUserId")[0].childNodes[0].data comments.append({"pubid":pubid, "pubnick":pubnick, "comcon":comcon, "comtime":comtime, "repid":repid}) else : comments = []``
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.