geek_crawler icon indicating copy to clipboard operation
geek_crawler copied to clipboard

返回的文章列表不能大于100

Open sunset-x opened this issue 3 years ago • 2 comments

在一个专栏里有大于100个的文章时,该脚本最大只能保存100个文章。 查看代码后发现 _articles 方法中的 'data = res.json().get('data', {})' 返回值中的list最大只有100。如图: image

sunset-x avatar Jul 14 '21 10:07 sunset-x

有什么完善的方法吗?

sunset-x avatar Jul 14 '21 10:07 sunset-x

390     def _articles(self, cid, pro):
391         """ 获取文章列表接口方法 """
392         global ALL_ARTICLES
393         log.info("请求获取文章列表接口:")
394         url = "https://time.geekbang.org/serv/v1/column/articles"
395         method = "POST"
396         headers = deepcopy(self.common_headers)
397         headers["Host"] = "time.geekbang.org"
398         headers["Origin"] = "https://time.geekbang.org"
399         headers["Cookie"] = self.cookie.cookie_string
400         params = {
401             "cid": cid,
402             "size": 200,
403             "prev": 0,
404             "order": "earliest",
405             "sample": "false"
406         }

"size": 200 这里默认是 100 ,改大一些看看呢

TCeason avatar Jul 14 '22 04:07 TCeason