如何抓取微博评论

WBOY
Release: 2016-06-06 20:35:44
Original
1605 people have browsed it

比如要抓取这条微博下的评论,通过抓取HTML来获取呢还是 微博接口来获取,我看了下接口,需要一个授权获取access_token然后才能获取评论,直接通过代码怎么让用户授权获取access_token呢?

回复内容:

比如要抓取这条微博下的评论,通过抓取HTML来获取呢还是 微博接口来获取,我看了下接口,需要一个授权获取access_token然后才能获取评论,直接通过代码怎么让用户授权获取access_token呢?

从控制台看一下
http://weibo.com/aj/v6/comment/big?ajwvr=6&id=3833719532508422&...
这个地址就是获取评论的 然后根据id来抓

如果不是全量抓取,建议你用微博api来抓,如果爬虫来抓,是需要登录相关信息的,也就是在curl的时候需要带上cookie相关信息,会比较复杂,如果cookie有一定实效性更麻烦了

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!