summaryrefslogtreecommitdiff
path: root/htt.py
blob: 49cec5438684186b559532c81e2c9f97797c530c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/python3
# -*- coding: utf-8 -*-


import argparse
import tweepy
from auth import *
from db import open_db
from live import listen_live
from tweepy import OAuthHandler
from users import listen_to_users


if __name__ == '__main__':
    """Start of the script."""

    auth = OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
    auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)

    api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)

    open_db()

    parser = argparse.ArgumentParser()
    parser.add_argument('-p', '--purge', help='Delete old liked Tweets', action='store_true')
    parser.add_argument('-d', '--daily', help='Analyse contents from selected followers', action='store_true')

    args = parser.parse_args()

    if args.purge:
        memory.purge_old_status()

    elif args.daily:
        listen_to_users(auth, api)

    else:
        listen_live(auth, api)