码迷,mamicode.com
首页 > 编程语言 > 详细

python 爬取简书评论

时间:2020-03-14 13:14:06      阅读:97      评论:0      收藏:0      [点我收藏+]

标签:ike   shu   chrome   esc   head   color   requests   url   port   

import json

import  requests
from lxml import etree
from time import sleep


url = "https://www.jianshu.com/shakespeare/notes/60479187/comments?page=1&count=100&author_only=false&order_by=desc"
headers = {
    "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36",
    "Refer":"https://www.jianshu.com"
}

resp = requests.get(url,headers=headers)
content = resp.content.decode(utf-8)
res = json.loads(content)
data = res[comments]


for item in data:
    print(item[compiled_content])

 

python 爬取简书评论

标签:ike   shu   chrome   esc   head   color   requests   url   port   

原文地址:https://www.cnblogs.com/php-linux/p/12491200.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!