No edit summary |
|||
Line 38: | Line 38: | ||
li = line.split(' ') | li = line.split(' ') | ||
random.shuffle(li) | random.shuffle(li) | ||
api.update_status(status = | clean=' '.join(li) | ||
print( | api.update_status(status = clean) | ||
print(clean) | |||
time.sleep(90) | time.sleep(90) | ||
Revision as of 13:05, 19 September 2015
Hello World!
Midterm Bot
This is a bot that takes a song from the band Interpol called Leif Erikson. It tries to take line by line from the lyrics and re-arrange them. My experiment was to see if some nice combinations could be created from lyrics that are very thoughtful and metaphoric.
So far the bot is running in twitter and is working, but I still need to clean it and take it a step further, I wan to take the lyrics from the song Roland (also from interpol) and mix them in one tweet, to make ir more interesting.
This is the code
import tweepy import sys import time import random from time import sleep #TWITTER KEYS consumer_key = "JgAFe2vulLO4KvSvHPdNI30xA" consumer_secret = "Zbu0zBP8g4sdS5LX4XrI9y3ddNdGfj0woSxxFgxiX5wrMNpC9X" access_token = "3329105651-NI0NPXV2HUCRTXPueHdEhzRCoKPNwwf3vxOd5yj" access_token_secret = "obFHhsKlQ7KlXAXOqz7c5zMf3qvYDSsfvtnw84cFBqV4N" auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.secure = True auth.set_access_token(access_token, access_token_secret) api = tweepy.API(auth) #INITIALIZATION l = "leifErikson.txt" leif = open (l) print("Leif Erikson is in da house") lines = leif.readlines() for line in lines: li = line.split(' ') random.shuffle(li) clean=' '.join(li) api.update_status(status = clean) print(clean) time.sleep(90) leif.close()