baidu_novels.py 文件源码

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

项目:owllook 作者: howie6879 项目源码 文件源码
def data_extraction_for_phone(html):
    with async_timeout.timeout(10):
        try:
            # Get title
            data_log = eval(html['data-log'])
            url = data_log.get('mu', None)
            if not url:
                return None
            # Get title
            title = html.find('h3').get_text()
            # Get author and update_time (option)
            novel_mess = html.findAll(class_='c-gap-right-large')
            basic_mess = [i.get_text() for i in novel_mess] if novel_mess else None
            return {'title': title, 'url': url, 'basic_mess': basic_mess}
        except Exception as e:
            LOGGER.exception(e)
            return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号