Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
409 views
in Technique[技术] by (71.8m points)

python 抓取公众号文章遇到验证问题

linux 下抓取微信公众号文章遇到验证问题!!!!!!!!

这是我要抓取的人民日报链接:http://mp.weixin.qq.com/profile?src=3&timestamp=1492739045&ver=1&signature=bSSQMK1LY77M4O22qTi37cbhjhwNV7C9V4aor9HLhAvbGc2ybWX*qg3WqxntZ7iq0kvYe87oPpcSJKFdmGMx5g==
1:首先浏览器上访问是正常的。
2:linux下访问提示需要验证,以下是简单的代码

url = http://mp.weixin.qq.com/profile?src=3&timestamp=1492738883&ver=1&signature=bSSQMK1LY77M4O22qTi37cbhjhwNV7C9V4aor9HLhAvbGc2ybWX*qg3WqxntZ7iq2xTLUTfxAMzK79UGvalY1A==
response = urllib2.urlopen(url)
print response.read()

访问的结果如下:
clipboard.png

补充说明下公众号链接的获取方式:
1:先访问链接:http://weixin.sogou.com/weixi...
2:再获取人民日报公众号的链接进行跳转。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

都不模拟header请求头的,就能抓取吗,建议先模拟request header再试一下


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...