Exemplo n.º 1
0
 def rebuild(self):
     self.dic = {}  # 重设地址、以免覆盖
     cont_json = reqjson(self.reallink['up'])['data']
     self.dic['up'] = {
         '姓名': cont_json['name'],
         '签名': cont_json['sign'],
         '头像地址': cont_json['face'],
         '个人空间': self.reallink['link'],
     }
     cont_json = reqjson(self.reallink['follow'])['data']
     self.dic['follow'] = {
         '关注数': cont_json['following'],
         '粉丝数': cont_json['follower'],
     }
     cont_json = reqjson(self.reallink['video_all'])['data']
     self.dic['video'] = {
         '获赞数': cont_json['likes'],
         '播放量': cont_json['archive']['view'],
         '阅读量': cont_json['article']['view'],
     }
     cont_json = reqjson(self.reallink['live'])['data']
     self.dic['live'] = {
         '直播状态': '正在直播' if cont_json['liveStatus'] else '未开播',
         '直播室号': cont_json['roomid'],
         '直播地址': cont_json['url'],
         '直播标题': cont_json['title'],
         '人气值': cont_json['online'],
         '直播封面地址': cont_json['cover'],
     }
Exemplo n.º 2
0
    def __init__(self, av):
        bv = ab.encode(int(av))
        reallink = 'https://api.bilibili.com/x/web-interface/view?bvid=' + str(
            bv)
        cont_json = reqjson(reallink)['data']

        self.dic = {
            'video': {
                'bv': ['bv号', cont_json['bvid']],
                'av': ['av号', cont_json['aid']],
                'title': ['标题', cont_json['title']],
                'pic': ['封面地址', cont_json['pic']],
                'descript': ['视频简介', cont_json['desc']],
                'dynamic': ['视频标签', cont_json['dynamic']],
            },
            'owner': {
                'o_name': ['Up主', cont_json['owner']['name']],
                'o_face': ['Up主头像地址', cont_json['owner']['face']],
            },
            'stat': {
                's_view': ['观看数', cont_json['stat']['view']],
                's_danmaku': ['弹幕数', cont_json['stat']['danmaku']],
                's_reply': ['评论数', cont_json['stat']['reply']],
                's_like': ['点赞数', cont_json['stat']['like']],
                's_coin': ['投币数', cont_json['stat']['coin']],
                's_favorite': ['收藏数', cont_json['stat']['favorite']],
                's_share': ['转发数', cont_json['stat']['share']],
            },
        }
Exemplo n.º 3
0
 def aid(self):  # 获取收藏夹所有aid,返回数组
     pn = 1
     fid = self.fid
     av_list = []
     while True:
         time.sleep(1)
         # 收藏【默认收藏夹】
         medias = f'https://api.bilibili.com/x/v3/fav/resource/list?media_id={fid}&pn={pn}&ps=20'
         pn += 1
         cont_json = reqjson(medias)
         cont_json = cont_json['data']['medias']
         if cont_json is not None:
             print(f'【log: 第{pn-1}页】', end='')  # 调试用
             for i in cont_json:
                 av_list.append(i['id'])
         else:  # 收藏夹翻页,翻到没有为止调出
             break
     return av_list
Exemplo n.º 4
0
 def title(self):  # 获取收藏夹名称,返回字符串
     medias = f'https://api.bilibili.com/x/v3/fav/resource/list?media_id={self.fid}&pn=1&ps=20'
     cont_json = reqjson(medias)
     return cont_json['data']['info']['title']
Exemplo n.º 5
0
 def islive(self):
     link = self.reallink['live']
     cont_json = reqjson(link)
     timestr = time.strftime('%Y-%m-%d %H:%M:%S',
                             time.localtime(time.time()))
     return [cont_json['data']['liveStatus'], timestr]
Exemplo n.º 6
0
 def fav_list(self):
     # 查看所有公开的收藏夹的fid(收藏夹id)
     favorite_id = f'https://api.bilibili.com/x/v3/fav/folder/created/list-all?up_mid={self.mid}'
     cont_json = reqjson(favorite_id)
     return cont_json['data']['list']