__init__.py 文件源码

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

项目:mycroft-skill-jupiter-broadcasting 作者: the7erm 项目源码 文件源码
def get_latest_episode(self, url, media=False):
        storage_path = join(self.file_system.path, 'feedcache')
        LOGGER.debug("storage_path:%s" % storage_path)
        storage = shelve.open(storage_path)
        ttl = 60 * 60
        link = ""
        try:
            fc = cache.Cache(storage, timeToLiveSeconds=ttl)
            parsed_data = fc.fetch(url)
            print "parsed_data.feed.title:", parsed_data.feed.title
            for entry in parsed_data.entries:
                pprint(entry)
                if media:
                    media_content = entry.media_content
                    if media_content:
                        link = entry.media_content[0]['url']
                else:
                    link = entry.link
                if link:
                    break
        finally:
            storage.close()
        return link
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号