├── LICENSE ├── Procfile ├── README.md ├── Readme images └── Screen Shot 2020-05-28 at 11.05.52 AM.png ├── config.py ├── credentials.py ├── requirements.txt └── twitterbot_retweet.py /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Chandrika Deb 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | worker: python twitterbot_retweet.py 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

GirlScript Twitter Bot

2 | 3 |
4 |

A Twitter Bot that automatically retweets, favourites the tweets with hashtag #girlscript

5 |
6 | 7 | 8 | ## Follow on Twitter - Click [Girlscript Bot](https://twitter.com/girlscript_bot) 9 | 10 | ### :star: Star us on GitHub — it helps! 11 | 12 | 13 |

14 | 15 |                                16 | ![Python](https://img.shields.io/badge/python-v3.6+-blue.svg) 17 | [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/chandrikadeb7/Girlscript-Twitter-Bot/issues) 18 | [![Forks](https://img.shields.io/github/forks/chandrikadeb7/Girlscript-Twitter-Bot.svg?logo=github)](https://github.com/chandrikadeb7/Girlscript-Twitter-Bot/network/members) 19 | [![Stargazers](https://img.shields.io/github/stars/chandrikadeb7/Girlscript-Twitter-Bot.svg?logo=github)](https://github.com/chandrikadeb7/Girlscript-Twitter-Bot/stargazers) 20 | [![Issues](https://img.shields.io/github/issues/chandrikadeb7/Girlscript-Twitter-Bot.svg?logo=github)](https://github.com/chandrikadeb7/Girlscript-Twitter-Bot/issues) 21 | [![MIT License](https://img.shields.io/github/license/chandrikadeb7/Girlscript-Twitter-Bot.svg?style=flat-square)](https://github.com/chandrikadeb7/Girlscript-Twitter-Bot/blob/master/LICENSE) 22 | [![LinkedIn](https://img.shields.io/badge/-LinkedIn-black.svg?style=flat-square&logo=linkedin&colorB=555)](https://www.linkedin.com/in/chandrika-deb/) 23 | 24 | ## 🚀  Installation 25 | 26 | #### Clone the repo 27 | ``` 28 | $ git clone https://github.com/chandrikadeb7/Girlscript-Twitter-Bot.git 29 | ``` 30 | 31 | #### Install tweepy Python module 32 | ``` 33 | $ pip install tweepy 34 | ``` 35 | ## :bulb: Working 36 | 37 | ### Sign up for a Twitter Developer Account 38 | * Create a separate Twitter account for your bot. 39 | * Sign up for Twitter Developer Account from this site - [Apply for a Twitter Developer Account](https://developer.twitter.com/en/apply-for-access) 40 | * Enter the necessary fields and await for email confirmation. 41 | * Click on [Create an app](https://developer.twitter.com/en/apps) 42 | * Enter the details and keep safe the access tokens generated. 43 | 44 | 45 | #### Enter your generated access tokens and consumer keys in the file credentials.py 46 | 47 | ``` 48 | consumer_key = '' 49 | consumer_secret = '' 50 | access_token = '' 51 | access_token_secret = '' 52 | ``` 53 | #### Edit the retweet and other details in the file config.py 54 | 55 | ``` 56 | # This is hastag which Twitter bot will search and retweet. You can edit this with any hastag .For example : '#javascript' 57 | QUERY = '#anything' 58 | 59 | # Twitter bot setting for liking Tweets 60 | LIKE = True 61 | 62 | # Twitter bot setting for following user who tweeted 63 | FOLLOW = True 64 | 65 | # Twitter bot sleep time settings in seconds. For example SLEEP_TIME = 300 means 5 minutes. 66 | # you can decrease it or increase it as you like.Please,use large delay if you are running bot all the time so that your account does not get banned. 67 | 68 | SLEEP_TIME = 300 69 | ``` 70 | 71 | ## :key: Deployment 72 | 73 | * Sign up for a free account in [Heroku](heroku.com) 74 | * Click on New -> Create new app 75 | * Enter the app-name in lower case and select your nearest region. 76 | * Choose Heroku CLI for deployment. Follow the steps given in Deploy tab. 77 | * Once the build is successful enable the Free Dynos option from Overview tab. 78 | 79 | ## :clap: And it's done! 80 | Feel free to **file a new issue** with a respective title and description on the the [Girlscript-Twitter-Bot](https://github.com/chandrikadeb7/Girlscript-Twitter-Bot/issues) repository. If you already found a solution to your problem, **I would love to review your pull request**! 81 | 82 | 83 | ## 📘  License 84 | The Girlscript Twitter Bot is released under the under terms of the [MIT License](LICENSE). 85 | 86 | ## :heart: Contributor 87 | Made by [Chandrika Deb](https://github.com/chandrikadeb7) 88 | -------------------------------------------------------------------------------- /Readme images/Screen Shot 2020-05-28 at 11.05.52 AM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chandrikadeb7/Girlscript-Twitter-Bot/f2ec16ce6a0592b50ee50327fa9de5165b1344a5/Readme images/Screen Shot 2020-05-28 at 11.05.52 AM.png -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | # Edit this confif file as you like 2 | 3 | # This is hastag which Twitter bot will search and retweet. You can edit this with any hastag .For example : '#javascript' 4 | 5 | QUERY = '#girlscript' 6 | 7 | # Twitter bot setting for liking Tweets 8 | LIKE = True 9 | 10 | # Twitter bot setting for following user who tweeted 11 | FOLLOW = True 12 | 13 | # Twitter bot sleep time settings in seconds. For example SLEEP_TIME = 300 means 5 minutes. 14 | # you can decrease it or increase it as you like.Please,use large delay if you are running bot all the time so that your account does not get banned. 15 | 16 | SLEEP_TIME = 300 17 | -------------------------------------------------------------------------------- /credentials.py: -------------------------------------------------------------------------------- 1 | # this is just a sample config file.You need to edit this file.You need to get these details from your Twitter app settings. 2 | 3 | consumer_key = '' 4 | consumer_secret = '' 5 | access_token = '' 6 | access_token_secret = '' 7 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | tweepy 2 | -------------------------------------------------------------------------------- /twitterbot_retweet.py: -------------------------------------------------------------------------------- 1 | import tweepy 2 | from time import sleep 3 | from credentials import * 4 | from config import QUERY, FOLLOW, LIKE, SLEEP_TIME 5 | 6 | auth = tweepy.OAuthHandler(consumer_key, consumer_secret) 7 | auth.set_access_token(access_token, access_token_secret) 8 | api = tweepy.API(auth) 9 | 10 | print("Twitter bot which retweets,like tweets and follow users") 11 | print("Bot Settings") 12 | print("Like Tweets :", LIKE) 13 | print("Follow users :", FOLLOW) 14 | 15 | for tweet in tweepy.Cursor(api.search, q=QUERY).items(): 16 | try: 17 | print('\nTweet by: @' + tweet.user.screen_name) 18 | 19 | tweet.retweet() 20 | print('Retweeted the tweet') 21 | 22 | # Favorite the tweet 23 | if LIKE: 24 | tweet.favorite() 25 | print('Favorited the tweet') 26 | 27 | # Follow the user who tweeted 28 | #check that bot is not already following the user 29 | if FOLLOW: 30 | if not tweet.user.following: 31 | tweet.user.follow() 32 | print('Followed the user') 33 | 34 | sleep(SLEEP_TIME) 35 | 36 | except tweepy.TweepError as e: 37 | print(e.reason) 38 | 39 | except StopIteration: 40 | break 41 | --------------------------------------------------------------------------------