2

我打算使用 google reader api 从博客和其他网站检索所有帖子。但是我在发布所有帖子时遇到了一些麻烦。我已经使用了延续字符串。从网站上,我可以看到有 5000 多个帖子,但我的代码只能检索 1000 个帖子。谁能帮我找出原因?谢谢。

我的代码如下:

class greader(GoogleReader):

    def __init__(self):
        super(greader,self).__init__()
        self.identify(*login_info)
        self.login_flag = self.login()

    def get_all_entries(self,feed=None,target="all"):

        entry_l = []
        kwargs = {'feed':feed,'order':CONST.ORDER_REVERSE,'count':800}
        if target == 'unread':
            kwargs['exclude_target'] = CONST.ATOM_STATE_READ

        xml_feed = self.get_feed(**kwargs)
        u_entries = xml_feed.get_entries()
        entry_l.append(u_entries)
        continuation = xml_feed.get_continuation()
        kwargs['continuation'] = continuation

        while continuation != None:
            #rand_int = random.randint(6,11)
            #time.sleep(rand_int)
            xml_feed = self.get_feed(**kwargs)
            u_entries = xml_feed.get_entries()
            continuation = xml_feed.get_continuation()
            kwargs['continuation'] = continuation
            entry_l.append(u_entries)

        return entry_l
4

0 回答 0