Example #1
0
def word2vid(keyword):
    keys = getkeys()
    consumer_key = keys[0]
    consumer_secret = keys[1]
    access_key = keys[2]
    access_secret = keys[3]

    line = keyword
    words = line.split(',')
    q = Queue(words)
    video_num = 0
    print(q.isEmpty())
    print(q.length())
    while not q.isEmpty():
        word = q.items[0]
        image0 = "images/" + str(video_num) + "-%01d.png"
        video = word + ".avi"
        tweets = gettweets(word, consumer_key, consumer_secret, access_key,
                           access_secret)
        makeImages(video_num, tweets)
        video_num = video_num + 1
        subprocess.call(
            ['ffmpeg', '-y', '-framerate', '.1', '-i', image0, video])
        q.queuedown()
    return keyword
Example #2
0
def getdata(keyword):
    keys = getkeys()
    auth = tweepy.OAuthHandler(keys[0], keys[1])
    auth.set_access_token(keys[2], keys[3])
    listener = MyListener()
    twitterStream = Stream(auth, listener)
    twitterStream.filter(track=keyword)
    datalist = listener.datalist
    return datalist
def getTweets(searchterm):
    keys = getkeys()
    auth = tweepy.OAuthHandler(keys[0], keys[1])
    auth.set_access_token(keys[2], keys[3])
    api = tweepy.API(auth, wait_on_rate_limit=True)
    termlength = len(searchterm)
    tweetlist = []

    for tweets in api.search(q=searchterm,
                             lang='en',
                             result_type='recent',
                             count=10):
        tweetlist.append(tweets.text)

    return tweetlist
Example #4
0
def word2vid(keyword):
    keys = getkeys()
    consumer_key = keys[0]
    consumer_secret = keys[1]
    access_key = keys[2]
    access_secret = keys[3]

    image0 = "images/" + str(keyword) + "-%01d.png"
    video = keyword + ".avi"
    tweets = gettweets(keyword, consumer_key, consumer_secret, access_key,
                       access_secret)
    makeImages(keyword, tweets)
    subprocess.call(['ffmpeg', '-y', '-framerate', '.1', '-i', image0, video])

    return keyword
        return True


def getTweets(searchterm):
    keys = getkeys()
    auth = tweepy.OAuthHandler(keys[0], keys[1])
    auth.set_access_token(keys[2], keys[3])
    api = tweepy.API(auth, wait_on_rate_limit=True)
    termlength = len(searchterm)
    tweetlist = []

    for tweets in api.search(q=searchterm,
                             lang='en',
                             result_type='recent',
                             count=10):
        tweetlist.append(tweets.text)

    return tweetlist


if __name__ == '__main__':
    keys = getkeys()
    auth = tweepy.OAuthHandler(keys[0], keys[1])
    auth.set_access_token(keys[2], keys[3])
    listener = MyListener()
    twitterStream = Stream(auth, listener)
    twitterStream.filter(track=["obama"])
    print(listener.datalist)
    print("lisener done")
    #getTweets("Obama")