weiboSpider icon indicating copy to clipboard operation
weiboSpider copied to clipboard

请问一下大大,如果我想爬取的是4.06-4.09这三天的微博,而不是爬取到现在,要怎么修改呀?

Open ooonice opened this issue 6 years ago • 4 comments

ooonice avatar May 10 '20 03:05 ooonice

这个需要先知道4-09的微博位于哪一页,然后从该页依此访问就可以。

本程序是从第一页开始获取,也就是从现在开始。微博是按时间倒序展示的,现在要获取4.06到4.09,就只需要获取4.09的页码,然后修改get_weibo_info方法,把如下代码中的第一个1改成4.09的页码就可以,

for page in tqdm(range(1, page_num + 1), desc='Progress'):

其它地方不用修改。如何知道4.09的页码,你如果只是暂时想这么获取,可以手动查看;如果想写成代码,需要用一些方法,比如二分法,总页数是n,先查看第n//2页是不是包含4.09的,如果时间比它早,再查看n//4的页面,否则查看3*n//4的页面,等等

dataabc avatar May 10 '20 05:05 dataabc

程序现在可以按时段获取微博,把since_date设置为2020-04-06,end_date设置为2020-04-09就可以只获取这几天的微博了,效率比上面的更高,更简单

dataabc avatar Jul 07 '20 05:07 dataabc

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 05 '20 05:09 stale[bot]

Closing as stale, please reopen if you'd like to work on this further.

stale[bot] avatar Sep 12 '20 06:09 stale[bot]