2

I am planning to use google reader api to retrieve all posts from blogs and other websites. But I have some troubles of getting all posts out. I already use continuation string. From the website, I could see there are more than 5000 posts, but my code can only retrieve 1000 posts. Can anyone help me to figure out the reason? Thanks.

My code is as following:

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
Filipe Correia
  • 5,415
  • 6
  • 32
  • 47
Taosof
  • 105
  • 7

0 Answers0