search.py 文件源码

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

项目:spider163 作者: Chengyumeng 项目源码 文件源码
def searchSinger(key):
    url = uapi.search_api
    data = {'s': key, 'offset': 0, 'limit': 10, 'type': "100"}
    req = requests.post(url, headers=uapi.header, data=data, timeout=10)
    if req.json()["result"]['artistCount'] == 0:
        pylog.log.warn("??? {} ????????".format(key))
        return
    artists = req.json()["result"]['artists']
    song_table = AsciiTable([["ID", "??", "????", "MV??"]])
    for item in artists:
        id = str(item['id'])
        name = item['name'].encode("utf-8")
        acount = str(item['albumSize'])
        mcount = str(item['mvSize'])
        song_table.table_data.append([id, name, acount, mcount])
    print(pylog.Blue("? \"{}\" ?????".format(key)))
    print(song_table.table)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号