'Is there a way to Scrape Twitter with selenium depending on different keywords automatically?

I am working on a project where I collect tweets depending on different 30 keywords, I used selenium since I need very old tweets, However, I have to enter each keyword manually each time, my question, is there a way that I can specify the required keywords from the beginning and it will search for it automatically? Like when I am using Tweepy I can simply specify the required keywords from the beginning and it will get all the tweets about it like :

keywords= ['cat','dog','Rabbit']

stream_tweet.filter(track=keywords,languages=['en'])

is there a way with selenium to do the same?



Solution 1:[1]

You can iterate through the list items one by one as follows:

keywords= ['cat','dog','Rabbit']
for keyword in keywords:
    stream_tweet.filter(track=keyword,languages=['en'])

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 undetected Selenium