Beispiel #1
0
# ALL YOUR SECRET STUFF!
# Make sure to replace the ''s below with your own values, or try to find
# a more secure way of dealing with your keys and access tokens. Be warned
# that it is NOT SAFE to put your keys and tokens in a plain-text script!

# Consumer Key (API Key)
cons_key = ''
# Consumer Secret (API Secret)
cons_secret = ''
# Access Token
access_token = ''
# Access Token Secret
access_token_secret = ''

# Log in to Twitter
tweetbot.twitter_login(cons_key, cons_secret, access_token, access_token_secret)

# The target string is what the bot will reply to on Twitter. To learn more,
# read: https://dev.twitter.com/streaming/overview/request-parameters#track
targetstring = 'MarryMeFreud'
# Keywords are words the bot will look for in tweets it'll reply to, and it
# will attempt to use them as seeds for the reply
keywords = ['marriage', 'ring', 'flowers', 'children', 'religion']
# The prefix will be added to the start of all outgoing tweets.
prefix = None
# The suffix will be added to the end of all outgoing tweets.
suffix = '#FreudSaysIDo'
# The maxconvdepth is the maximum depth of the conversation that the bot will
# still reply to. This is relevant if you want to reply to all tweets directed
# at a certain user. You don't want to keep replying in the same conversation,
# because that would be very annoying. Be responsible, and allow your bot only
# ALL YOUR SECRET STUFF!
# Make sure to replace the ''s below with your own values, or try to find
# a more secure way of dealing with your keys and access tokens. Be warned
# that it is NOT SAFE to put your keys and tokens in a plain-text script!

# Consumer Key (API Key)
cons_key = 'ZSA2kpz1egohMzMm7b3rUNrE3'
# Consumer Secret (API Secret)
cons_secret = 'AE9WmanoXPZrVYkg4keQKOVKRQRaaDtEcHoelMgiBSgu382g8A'
# Access Token
access_token = '1070084671562805248-zFaI5h5HTZppKDl2CUcrVive4QK167'
# Access Token Secret
access_token_secret = 'KR1Q2Dl4pBpQleKr8Rc45rcyJvGHXgmMiiYNzOmJuxQkZ'

# Log in to Twitter
tweetbot.twitter_login(cons_key, cons_secret, access_token,
                       access_token_secret)

# The target string is what the bot will reply to on Twitter. To learn more,
# read: https://dev.twitter.com/streaming/overview/request-parameters#track
targetstring = 'MarryMeFreud'
# Keywords are words the bot will look for in tweets it'll reply to, and it
# will attempt to use them as seeds for the reply
keywords = ['marriage', 'ring', 'flowers', 'children', 'religion']
# The prefix will be added to the start of all outgoing tweets.
prefix = None
# The suffix will be added to the end of all outgoing tweets.
suffix = '#FreudSaysIDo'
# The maxconvdepth is the maximum depth of the conversation that the bot will
# still reply to. This is relevant if you want to reply to all tweets directed
# at a certain user. You don't want to keep replying in the same conversation,
# because that would be very annoying. Be responsible, and allow your bot only
Beispiel #3
0
tweetbot.read(book)

# # # # #
# TEXT GENERATION

# Generate text by using the generate_text method:
# 	The first argument is the length of your text, in number of words
# 	The 'seedword' argument allows you to feed the bot some words that it
# 	should attempt to use to start its text. It's nothing fancy: the bot will
# 	simply try the first, and move on to the next if he can't find something
# 	that works.
my_first_text = tweetbot.generate_text(maxlength=15)

# Print your text to the console
print(u'\ntweetbot says: "%s"' % (my_first_text))
"""
# # # # #
# TWITTER

# The MarkovBot uses @sixohsix' Python Twitter Tools, which is a Python wrapper
# for the Twitter API. Find it on GitHub: https://github.com/sixohsix/twitter

# ALL YOUR SECRET STUFF!
# Make sure to replace the ''s below with your own values, or try to find
# a more secure way of dealing with your keys and access tokens. Be warned
# that it is NOT SAFE to put your keys and tokens in a plain-text script!

# Consumer Key (API Key)
cons_key = ''
# Consumer Secret (API Secret)
cons_secret = ''
Beispiel #4
0
    tfidf = vectorizer.fit_transform([text1, text2])
    return ((tfidf * tfidf.T).A)[0, 1]


'''
Keys/Tokens: 
'''

cons_key = 'TRXh3CDSFBnPuZziANbqssl1l'
cons_secret = 'sIfuEEp6T8qluDkU3S9PLcINoIIqcp0SUTrnwVfvdWhNRlIS6G'
access_token = '863265431691436032-PH9ASi1r3tfXJY90i4HuCVVpcLhUJ6D'
access_token_secret = 'POslJ4RgWsgL7BzUV1WY7xZaI9YXGMmSIFPwA2vcZt1Uf'

# Login, tweet-period

bot.twitter_login(cons_key, cons_secret, access_token, access_token_secret)
bot.twitter_tweeting_start(days=0,
                           hours=5,
                           minutes=0,
                           keywords=None,
                           prefix=None,
                           suffix="#Freud")
bot2.twitter_login(cons_key, cons_secret, access_token, access_token_secret)
bot2.twitter_tweeting_start(days=0,
                            hours=5,
                            minutes=0,
                            keywords=None,
                            prefix=None,
                            suffix="#Shakespeare")
bot3.twitter_login(cons_key, cons_secret, access_token, access_token_secret)
bot3.twitter_tweeting_start(days=0,
Beispiel #5
0
            f.write(tweet.text.encode("utf-8") + ' '.encode("utf-8"))

    pass


get_all_tweets("kanyewest")
kanyebot = MarkovBot()

# Get the current directory's path
dirname = os.path.dirname(os.path.abspath(__file__))
# Construct the path to the book
tweets = os.path.join(dirname, 'kanyewest_tweets.txt')
# Make your bot read the book!
kanyebot.read(tweets)

kanyebot.twitter_login(consumer_key, consumer_secret, access_key,
                       access_secret)

# Set some parameters for your bot
targetstring = 'KanyeToTheBot'
keywords = ['kim', 'pablo', 'wavy', 'bill', 'cosby']
prefix = None
suffix = '#KanyeToTheBot'
maxconvdepth = None

# Start periodically tweeting
kanyebot.twitter_tweeting_start(days=0,
                                hours=0,
                                minutes=15,
                                keywords=None,
                                prefix=None,
                                suffix='#KanyeToTheBot')
import os, ssl

print os.environ['cons_key']
print os.environ['cons_secret']
print os.environ['access_token']
print os.environ['access_token_secret']

from markovbot import MarkovBot
#Initialize a MarkovBot instance
tweetbot = MarkovBot()
dirname = os.path.dirname(os.path.abspath("tmg copy.text"))
# Construct the path to the book
book = os.path.join(dirname, 'tmg copy.text')
# Make your bot read the book!
tweetbot.read(book)
my_first_text = tweetbot.generate_text(25,
                                       seedword=[
                                           'you',
                                           'I am',
                                           'going to',
                                           'my',
                                           'love',
                                       ])
print(my_first_text)
tweetbot.twitter_login(os.environ['cons_key'], os.environ['cons_secret'],
                       os.environ['access_token'],
                       os.environ['access_token_secret'])
# Start periodically tweeting
#tweetbot.twitter_tweeting_start(days=0, hours=0, minutes=5 keywords=None, prefix=None, suffix=None)
tweetbot._t.statuses.update(status=my_first_text)
 	
# # #
# TWITTER

# The MarkovBot uses @sixohsix' Python Twitter Tools, which is a Python wrapper
# for the Twitter API. Find it on GitHub: https://github.com/sixohsix/twitter

# Credentials

with open(text_filename, 'r') as f:
	twitter_credentials = json.load(f)

# Log in to Twitter
tweetbot.twitter_login(twitter_credentials['consumer_key'], 
                       twitter_credentials['consumer_secret'], 
                       twitter_credentials['access_key'], 
                       twitter_credentials['access_secret'])

# The target string is what the bot will reply to on Twitter. To learn more,
# read: https://dev.twitter.com/streaming/overview/request-parameters#track
targetstring = 'Orgullo Gay'
# Keywords are words the bot will look for in tweets it'll reply to, and it
# will attempt to use them as seeds for the reply
keywords = ['marriage', 'ring', 'flowers', 'children', 'religion']
# The prefix will be added to the start of all outgoing tweets.
prefix = None
# The suffix will be added to the end of all outgoing tweets.
suffix = '#OrgulloLGTBI'
# The maxconvdepth is the maximum depth of the conversation that the bot will
# still reply to. This is relevant if you want to reply to all tweets directed
# at a certain user. You don't want to keep replying in the same conversation,