ReadRssFeed.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:Rasp-AIY-Project-Files 作者: markblue777 项目源码 文件源码
def getNewsFeed(self):
        # parse the feed and get the result in res
        res = feedparser.parse(self.rssFeedUrl)

        # get the total number of entries returned
        resCount = len(res.entries)

        # exit out if empty
        if resCount == 0:
            return ""

        # if the resCount is less than the feedCount specified cap the feedCount to the resCount
        if resCount < self.feedCount:
            self.feedCount = resCount

        # create empty array
        resultList = []

        # loop from 0 to feedCount so we append the right number of entries to the return list
        for x in range(0, self.feedCount):
            resultList.append(res.entries[x])

        return resultList
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号