Hi!
I have created a Twitter List by the following lines:
import tweepy
# name of the list
name = "tweepy_list"
client = tweepy.Client(consumer_key=consumer_key, consumer_secret=consumer_secret, access_token=access_token, access_token_secret=access_token_secret)
l = client.create_list(name)
id_l = l[0]['id']
Where id_l is the list id.
I have added users to the list by:
client.add_list_member(id_l, user_id)
Now, I want to build a search query by this code and I want to include the list of users I previously created by:
query = "{0} lang:es -is:retweet list:{1}:".format(topic, id_l)
tweets = client.search_recent_tweets(query=query,
tweet_fields = ["created_at", "text", "source"],
user_fields = ["name", "username", "location", "verified", "description"],
max_results = 10,
expansions='author_id',
user_auth=True
)
But I am getting this error:
> BadRequest: 400 Bad Request
> There were errors processing your request: Reference to invalid operator 'list'. Operator is not available in current product or product packaging. Please refer to complete available operator list at https://developer.twitter.com/en/docs/twitter-api/enterprise/rules-and-filtering/operators-by-product
I have asked about this impasse to the Stack Overflow community,
https://stackoverflow.com/questions/73299028/twitter-query-including-a-list-id-with-tweepy-python.
They suggested it is probably a bug.
What is your opinion about this difficulty?
Thank you!