找到七里香这首歌的精彩评论
URL https://c.y.qq.com/base/fcgi-bin/fcg_global_comment_h5.fcg?g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=GB2312¬ice=0&platform=yqq.json&needNewCode=0&cid=205360772&reqtype=2&biztype=1&topid=102065756&cmd=8&needmusiccrit=0&pagenum=0&pagesize=25&lasthotcommentid=&domain=qq.com&ct=24&cv=10101010
#9 在QQ音乐中查找七里香这首歌的精彩评论
# 找到七里香这首歌的精彩评论
# URL https://c.y.qq.com/base/fcgi-bin/fcg_global_comment_h5.fcg?g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=GB2312¬ice=0&platform=yqq.json&needNewCode=0&cid=205360772&reqtype=2&biztype=1&topid=102065756&cmd=8&needmusiccrit=0&pagenum=0&pagesize=25&lasthotcommentid=&domain=qq.com&ct=24&cv=10101010 import requests res = requests.get('https://c.y.qq.com/base/fcgi-bin/fcg_global_comment_h5.fcg?g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=GB2312¬ice=0&platform=yqq.json&needNewCode=0&cid=205360772&reqtype=2&biztype=1&topid=102065756&cmd=6&needmusiccrit=0&pagenum=0&pagesize=15&domain=qq.com&ct=24&cv=10101010') html = res.json()
pages = int(html['comment']['commenttotal'] / 15 + 1) item_num = 0 for i in range(0,pages):
res = requests.get('https://c.y.qq.com/base/fcgi-bin/fcg_global_comment_h5.fcg?g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=GB2312¬ice=0&platform=yqq.json&needNewCode=0&cid=205360772&reqtype=2&biztype=1&topid=102065756&cmd=6&needmusiccrit=0&pagenum={}&pagesize=15&domain=qq.com&ct=24&cv=10101010'.format(i))
html = res.json()
items = html['comment']['commentlist'] for item in items:
item_num = item_num + 1
print(item_num,end='\t')
try:
print(item['rootcommentcontent'])
except KeyError:
print(item['middlecommentcontent'][0]['subcommentcontent']) '''
执行结果如下:
1 这首歌唤醒了所有关于你的记忆,我又看见了你帮我画手抄报的侧颜,听见了我们九月里散步踩碎落叶的响声,
2 那年夏天的黄昏将泥砌的墙涂成炽热颜色,窗外麻雀窃窃私语着什么,院内梧桐叶层层叠叠,我忧心着麻雀忘记
3 七月的知了将夏天唤醒,手中的铅笔在稿纸上肆意的涂鸦。房间里散发着栀子花香,淡风轻轻拂动淡色的窗帘。 305 风 于是 开始离开 晴了天\n\n风 于是 开始选择\n选择 夏天\n那里 有下雨 躲雨的屋檐\n\n风 于是 开始选择
307 这首歌,是我爱上的第一首歌。秋刀鱼的滋味,是我爱上周董的味道。他唱出了一代人的青春,他是天王,是我
308 若天晴少了七里香的芬芳\n那回忆 还算什么诗一般的盛夏\n于是风铃 开始摇晃雨季属于本身的感伤\n但我们
'''