栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

python 知乎爬虫框架

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

python 知乎爬虫框架

可获取zhihu的关键词搜索、热榜、用户、回答、专栏文章、评论、关联关键词、关联文章等信息

if __name__ == '__main__':
	# 设置代理; 如采集量较大,建议自行搭建代理池和cookie池
	set_proxy({'http': 'http://127.0.0.1:8125', 'https': 'http://127.0.0.1:8125'})
	
	# 设置cookie
	set_cookie({'d_c0': 'AIBfvRMxmhSPTk1AffR--QLwm-gDM5V5scE=|1646725014'})
	
	# 搜索采集使用案例:
	for info in search_crawl(key_word='天空', count=10):
	    print(info)
	
	# 可传入data_type 指定搜索类型
	for info in search_crawl(key_word='天空', count=10, data_type='answer'):
	    print(info)
	
	# 用户信息回答列表使用案例(采集该用户下指定数量的回答信息,每条回答采集指定数量的评论):
	for info in user_crawler('wo-men-de-tai-kong',
	                         answer_count=50,
	                         comment_count=50
	                         ):
	    print(info)
	
	# 用户信息提问列表使用案例(采集该用户信息及指定数量的问题信息,每条问题指定数量的回答,每条回答指定数量的评论):
	for info in user_crawler('wo-men-de-tai-kong',
	                         question_count=10,
	                         drill_down_count=10,
	                         comment_count=50
	                         ):
	    print(info)
	
	# 热点问题采集使用案例
	# 采集 前10个问题, 每个问题采集10条回答
	for info in hot_questions_crawl(question_count=10, drill_down_count=10):
	    print(info)
	
	# 可传入period 指定热榜性质。如小时榜、日榜、周榜、月榜
	# 传入domains 采集指定主题的问题
	for info in hot_questions_crawl(question_count=10, period='day', domains=['1001', 1003]):
	    print(info)

github地址:https://github.com/niuniuJQKKK/zhihu_crawler

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1018167.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号