Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 30, 2022. It is now read-only.

00000vish/Simple-Python-TwitterBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simple-Python-TwitterBot

Simple python code i created for my twitter bots using Tweepy. It is able to listen to keyword and retweet and/or favorite them. Exmaple: @Jothipala_Bot

Video

Video

Requirements

Tweepy (installed).

Need to have twitter app with Oauth keys and etc.

Python 3.4 recommended.

Oauth

Fill in Oauth info to

  • ckey = 'here'
  • csecret = 'here'
  • atoken = 'here'
  • asecret = 'here'

Favorite

To favorite a tweet you would add

 fav(tweet_cid)

in on_data method.

Retweet

To retweet a tweet you would add

 retweet(tweet_cid)

in on_data method.

UnFavorite

To unfavorite a tweet you would add

 unfav(tweet_cid)

in on_data method.

Streaming API

 track_words=["#SriLanka"]
 ...
 twt.filter(track= track_words) 

This will listen to "#SriLanka" tag live.

If you want to listen to tweets from a certian account:

 follow_acc = ['2312312' , '1234332'] # all username converted to user ids
 ...
 twt.filter(follow = follow_acc)

If you want to listen to tweets from a certian location:

 loc = [-74.255735,40.496044,-73.7002721,40.9152555] #Box cordinations at the location
 ...
 twt.filter(locations=loc)

Bans and Whitelists

If you want to not retweet or favorite a tweet from a certian account or tweets with words, put them into the following arrays.

 banned_accs = ['twitter' , 'twittersupport'] # banned account screen name goes in here
 banned_words = ['hate' , 'derp'] # banned words goes in here
 whitelist_acc = ['twitter' , 'twittersupport'] # banned account screen name goes in here
 whitelist_words = ['Hellow' , 'Daft Punk'] # banned words goes in here

About

[very outdated] simple python code i created for my twitter bot

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages