This code is for a bot which will find a Twitter user's most tweeted word and tweet that word, tagging said user

Overview

max_tweeted_word

This code is for a bot which will find a Twitter user's most tweeted word and tweet that word, tagging said user

The program uses tweepy to access Twitter API

HOW THE BOT WORKS: The bot will scan through its followers and for every follower, will scan the user's tweets and tweet their most tweeted word in the format: @username's most tweeted word is [word] (number of times word is used)

To find their most tweeted word, a Twitter user will have to follow this bot's account.

As of now, a user following the bot will not act as a trigger. I will manually be running the bot from my machine a few times a day to work it.

LOGIC

  1. Getting a user from followers list:
  • first, I open a blank .txt file
  • next, using the api.followers(user) function, I pulled the bot's followers
  • scan through the followers and filter out the protected accounts -- add the selected user IDs to a followers_list
  • cycle through the followers_list formed in the above step with a for loop
  • IF "follower" in the for loop iteration is not in the .txt file, append users_list with "follower" and also append .txt file
  • the above step makes sure the bot does not run for the same account more than once
  • choose only 5 users at a time.
  1. Finding max tweeted word:
  • This is for chosen user among 5 users in users_list
  • Pull all tweets of the user. Twitter API limits maximum tweets to be pulled at 200. To bypass this and pull all (up to ~3,500) tweets, cycle through tweets by filtering by using tweet_id which is timestamped
  • store all tweets in a list
  • initialize a words_list and a words_count_list to store the words tweeted by the user and corresponding count
  • in a for loop, for every tweet, pull tweet.text to extract the text content mentioned in each element of the tweets list from the step above
  • once tweet.text is extracted, comb through each word with for loop. For word selected in for loop, convert it to small-case to avoid multiple counting. For example, YES, Yes and yes are all considered to be different words if case insensitisation is not done. Check if word selected in for loop iteration exists in words_list. If YES, then find index of word in words_list and increment element at index in words_count. If NO, check if chosen word in the loop is NOT in the words_to_filter.txt file. If word is not in words_to_filter.txt, append word in words_list and then do index matching as mentioned in the YES step
  • after this, sort the words_count_list in reverse order -- element at pos [0] is the count of the max tweeted word. Find index of element at [0] in sorted list in words_count_list and the word at this index is the most tweeted word
  1. Tweeting
  • using api.update_status, tweet in the format @username's most tweeted word is [word] (number of times word is used)
Owner
Yasho Bapat
Yasho Bapat
A new coin listing alert bot using Python, Flask, MongoDB, Telegram API and Binance API

Bzzmans New Coin Listing Detection Bot Architecture About Project Work in progress. This bot basically gets new coin listings from Binance using Binan

Eyüp Barlas 21 May 31, 2022
A powerful Lavalink library for Discord.py.

A robust and powerful Lavalink wrapper for Discord.py! Documentation Official Documentation. Support For support using WaveLink, please join the offic

Pythonista 254 Dec 29, 2022
Autofill HZDR Zeitman entries

Zeitman_autofill Filling out Zeitman is boring. This script might make some of the pain go away. Requirements The selenium package and Chrome webdrive

Tim Callow 8 Mar 14, 2022
Compulsory join Telegram Bot

mussjoin About Compulsory join Telegram Bot this Telegram Bot Application can be added users to Telegram Channel or Group compulsorily. in addition wh

Hamed Mohammadvand 4 Dec 03, 2021
Search stock images (e.g. via Unsplash) and save them to your Wagtail image library.

Wagtail Stock Images Search stock images (e.g. via Unsplash) and save them to your Wagtail image library. Requirements Python 3 Django = 2 Wagtail =

Vicktor 12 Oct 12, 2022
Upload-Instagram - Auto Uploading Instagram Bot

###Instagram Uploading Bot### Download Python and Chrome browser pip install -r

byeonggeon sim 1 Feb 13, 2022
Algofi Python SDK is useful for developers who want to programatically interact with the Algofi lending protocol

algofi-py-sdk Algofi Python SDK Documentation https://algofi-py-sdk.readthedocs.

Algofi 41 Dec 15, 2022
Telegram bot to clip youtube videos

youtube-clipper-bot Telegram bot to clip youtube videos How to deploy? Create a file called config.env BOT_TOKEN: Provide your bot token generated by

Shivam Jha 11 Dec 10, 2022
telegram bot that calculates file hash / Dosya toplamı hesaplayan telegram botu

Telegram File Hash Bot FileHashBot: 🇬🇧 Bot that calculates file hashes. 🇹🇷 Dosya toplamları hesaplayan bot. Demo in Telegram: @FileHashBot 🇬🇧 Se

Hüzünlü Artemis [HuzunluArtemis] 5 Jun 29, 2022
👾 Telegram Smart Group Assistant 🤖

DarkHelper 🌖 Features ⚡️ Smart anti-apam & anti-NFSW message checker Tag Members , Entertain facility , Welcommer ban , unban , mute , unmute , lock

amirali rajabi 38 Dec 18, 2022
twitter bot tha uses tweepy library class to connect to TWITTER API

TWITTER-BOT-tweepy- twitter bot that uses tweepy library class to connect to TWITTER API replies to mentions automatically and follows the tweet.autho

Muziwandile Nkomo 2 Jan 08, 2022
Simple Webhook Spammer with Optional Proxy Support

😎 �Simple Webhook Spammer with Optional Proxy Support:- [+] git clone https://g

Terminal1337 12 Sep 29, 2022
Telegram bot implementing Lex Arcana using python-telegram-bot library.

Lex Arcana Telegram Bot 🤖 Telegram bot implementing Lex Arcana using python-telegram-bot library. This bot was evaluated for the course "Computer Eng

Nicolò Sonnino 6 Jun 22, 2022
A simple python discord bot with commands for moderation and utility.

Discord Bot A simple python discord bot with commands for moderation, utility and fun. Moderation $kick user reason - Kick a user from the server

syn 3 Feb 06, 2022
This software's intent is to automate all activities related to manage Axie Infinity Scholars. It is specially aimed to mangers with large scholar roasters.

Axie Scholars Utilities This software's intent is to automate all activities related to manage Scholars. It is specially aimed to mangers with large s

Ferran Marin 153 Nov 16, 2022
A free, minimal, lightweight, cross-platform, easily expandable Twitch IRC/API bot.

parky's twitch bot A free, minimal, lightweight, cross-platform, easily expandable Twitch IRC/API bot. Features 🔌 Connect to Twitch IRC chat! 🔌 Conn

Andreas Schneider 10 Dec 30, 2022
Automatically pick a winner who Retweeted, Commented, and Followed your Twitter account!

AutomaticTwitterGiveaways automates selecting winners for "Retweet, Comment, Follow" type Twitter giveaways.

1 Jan 13, 2022
A simple bot to upload file to various cloud servers.

Cloudsy Bot A simple bot to upload file to various cloud servers. Variables API_HASH Your API Hash from my.telegram.org API_ID Your API ID from my.tel

Flying Santas 8 Oct 31, 2022
Kakatua discord music bot

Donate Ayo donasi! Lokal Internasional Ucapan Terima Kasih Tentu saja, donatur Bunga dan talent-talent h!mawari. Semoga rezeki teman-teman semakin lan

1 Oct 30, 2021
Trading bot - A Trading bot With Python

Trading_bot Trading bot intended for 1) Tracking current prices of tokens 2) Set

Tymur Kotkov 29 Dec 01, 2022