twitter/daily.py
def crawl(self, last_id):
        ''' Crawl new tweet from user timeline.
            :param last_id: last tweet's id in database
            :return list:
        '''
        if type(last_id) != int:
            raise TypeError("arg last_id expects int")
        url = "https://api.twitter.com/1.1/statuses/user_timeline.json"
        params = {
            'count': 200,
            'since_id': last_id,
            'max_id': None,
            'trim_user': True,
            'contributor_details': False,
            'exclude_replies': False,
            'include_rts': True,
        }

        while True:
            response = self.session.get(url, params=params)
            tweets = json.loads(response.text)
            if len(tweets) > 0:
                yield from tweets
                params['max_id'] = tweets[-1]['id'] - 1
            else:
                break
 Crawl new tweet from user timeline.
            :param last_id: last tweet's id in database
            :return list:
        
Crawl new tweet from user timeline.
Crawl new tweet from user timeline .
def crawl(self, last_id):
        if type(last_id) != int:
            raise TypeError("arg last_id expects int")
        url = "https://api.twitter.com/1.1/statuses/user_timeline.json"
        params = {
            'count': 200,
            'since_id': last_id,
            'max_id': None,
            'trim_user': True,
            'contributor_details': False,
            'exclude_replies': False,
            'include_rts': True,
        }
        while True:
            response = self.session.get(url, params=params)
            tweets = json.loads(response.text)
            if len(tweets) > 0:
                yield from tweets
                params['max_id'] = tweets[-1]['id'] - 1
            else:
                break
def crawl ( self , last_id ) : if type ( last_id ) != int : raise TypeError ( "arg last_id expects int" ) url = "https://api.twitter.com/1.1/statuses/user_timeline.json" params = { 'count' : 200 , 'since_id' : last_id , 'max_id' : None , 'trim_user' : True , 'contributor_details' : False , 'exclude_replies' : False , 'include_rts' : True , } while True : response = self . session . get ( url , params = params ) tweets = json . loads ( response . text ) if len ( tweets ) > 0 : yield from tweets params [ 'max_id' ] = tweets [ - 1 ] [ 'id' ] - 1 else : break
Crawl new tweet from user timeline.
Crawl new tweet from user timeline .
''' Crawl new tweet from user timeline.
            :param last_id: last tweet's id in database
            :return list:
        '''
None
list
self
last_id
last tweet's id in database
last tweet ' s id in database