ex1.py 文件源码

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

项目:aiospider 作者: HeartUnchange 项目源码 文件源码
def parse_category(response: aiohttp.Response):
        '''
        response can be parsed to a json-object.
        The field `Count` stands for how many emojis this category have.
        The field `title` is the name of this category.
        '''
        js = await response.json()
        if not js.get("Count", 0):
            return
        category = js.get("title", "").strip() # name of folder no blank space
        if not category:
            return
        confirmDir(category)
        # emojis contained by `picList`
        for pic in js.get("picList", []):
            src = pic.get("link", "")  # emoji's download link
            eid = pic.get("eid", "")  # emoji's id
            if not src:
                continue
            # name for saving
            name = str(eid) + splitext(src)[1] if eid else basename(src)
            dst = join(os.curdir, category, name)
            await ss.download(src, dst)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号