解析json文本
import json
import pandas as pd
file = open(r'文件地址.txt',encoding='utf-8')
a=file.readlines()
res=[]
for i in a:
for m in json.loads(i)['aweme_list']:
res += [{'desc':m['desc'],'create_time':m['create_time'],'share_url':m['share_url'],'collect_count':m['statistics']['collect_count'],'comment_count':m['statistics']['comment_count'],'digg_count':m['statistics']['digg_count'],'share_count':m['statistics']['share_count']}]
res_df['public_time'] = res_df.apply(lambda x:time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(x['create_time'])),axis=1)
res_df = pd.DataFrame(res)