The following code illustrates how to write a Twitter bot that automatically finds relevant users to follow, and unfollows users that haven't followed back. In the example usage, the bot intakes a seed list of influencers and harvests information about their followers. It then selectively follows a subset of the most relevant users, given a set of customizable conditions (e.g., language, keywords, Tweet frequency). In keeping with API limits, the bot auto-follows 250 new users at a time, caching a "blacklist" of users that have already been added.
Introductory coding demos in Python. Click the file name in the lower left-hand corner to view full screen at Github.