def main(): api = create_api() while True: public_tweets(api) keyword_finder(api) follow_followers(api) time.sleep(60)
def main(): api = create_api() while True: follow_followers(api) public_tweets(api) # tweet_memes(api) time.sleep(60)
def main(keywords): """ Main method to initialize the api, create a Stream_Listener object to track tweets based on certain keywords and follow tweet owners. """ api = create_api() print('Waiting for tweets...') my_stream_listener = Stream_Listener(api) my_stream = tweepy.Stream(auth=api.auth, listener=my_stream_listener) my_stream.filter(track=keywords, languages=["en"])
def main(keywords): api = create_api() tweets_listener = FavRetweetListener(api) stream = tweepy.Stream(api.auth, tweets_listener) stream.filter(track=keywords, languages=["en"])
# This module searches through twitter for tweets with the hashtag #gis chat from app.config import create_api import tweepy import time import logging import datetime from time import ctime logging.basicConfig(level=logging.INFO) logger = logging.getLogger() search_strings = ['#gischat', '#GISChat', '#GISCHAT'] api = create_api() # function to handle twitter limits def limit_handler(cursor): try: while True: yield cursor.next() except tweepy.RateLimitError: time.sleep(1000) # A follow_followers function that accepts api and check if they are not followed, then follow them def follow_followers(api): logger.info("Retrieving and following followers") for follower in limit_handler(tweepy.Cursor(api.followers).items()): if not follower.following: logger.info(f"Following {follower.name}")
def main(): api = create_api() process_friends(api=api) _log.info("FIN the Friending")