tweetcount.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:twitter_word_count 作者: prrateekk 项目源码 文件源码
def past(name,d):
    # Global variable count initialized to 0
    global count
    count = 0
    # variable u storing todays date.
    u=datetime.date.today()
    # Cursor searching for tweet with matching query 'q=name'
    # 'since' refers to the starting date
    # 'until' refers to today's date
    # whenever the tweet with the matching query is fetched the count variable is incremented by one.
    for tweet in tweepy.Cursor(api.search,q=name,since=u-datetime.timedelta(d),until=u,lang='en').items():
        count+=1
# REST API ends here.


# Flask routing.
# local host with template index.html(can be found in the template folder)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号