Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import tweepy
- import markovify
- from twitter_credentials import ACCESS_TOKEN, ACCESS_TOKEN_SECRET, CONSUMER_SECRET, CONSUMER_KEY
- auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
- auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
- api = tweepy.API(auth)
- with open("corpus.txt") as corpus:
- corpus_lines = corpus.read()
- text_model = markovify.Text(corpus_lines)
- message = text_model.make_short_sentence(140)
- twt = api.search(q="#Ancient", since_id=3600)
- for s in twt:
- sn = s.user.screen_name
- m = message, (sn)
- s = api.update_status(m, s.id)
Advertisement
Add Comment
Please, Sign In to add comment