media_info.py 文件源码

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

项目:anime-birb-uk 作者: Arctice 项目源码 文件源码
def fetch_info(id, type):
    """
    Returns a dictionary with information about the media(id, type).
    Currently only fetches 'members'(popularity count).
    """
    validate_media(type)

    url = media_url(id, type)

    try:
        response = requests.get(url)
        html = response.content
        return extract_info(html)
    except requests.ConnectionError:
        print(f"Timed out on fetching {type}:{id} info")
        return None
    except Exception as err:
        print(id, type, '-', response.status_code, '-', err)
        if response.status_code == 404:
            return []
        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号