mabaoguo

def get_data(url,headers):
    data_m = pd.DataFrame(columns=['id','name','view_count','like_count','duration','author_name','author_id','bvid'])
    html = requests.get(url,headers=headers).content
    data = json.loads(html.decode('utf-8'))
    offset = data['data']['offset']
    print(offset)
    for j in range(30):
        data_m = data_m.append({'id':data['data']['list'][j]['id'],'name':data['data']['list'][j]['name'],
                            'view_count':data['data']['list'][j]['view_count'],'like_count':data['data']['list'][j]['like_count'],
                            'duration':data['data']['list'][j]['duration'],'author_name':data['data']['list'][j]['author_name'],
                            'author_id':data['data']['list'][j]['author_id'],'bvid':data['data']['list'][j]['bvid']},ignore_index=True)
    return(offset,data_m)
已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 护眼 设计师:闪电赇 返回首页
实付 19.90元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值