Hello,

I am using Python’s searchtweets_v2 to get tweets using the contains: operator, but I get the following error:

HTTP Error code: 400: {“errors”:[{“parameters”:{“query”:[“et contains:ance lang:fr”]},“message”:“There were errors processing your request: Reference to invalid operator ‘contains’. Operator is not available in current product or product packaging. Please refer to complete available operator list at xxx. (at position 4)”}],“title”:“Invalid Request”,“detail”:“One or more parameters to your request was invalid.”,“type”:“xxx”} | Bad Request
Request payload: {‘query’: ‘et contains:ance lang:fr’, ‘max_results’: 500}
Quitting…

Endpoint in yaml file is 2/tweets/search/all

The code I used:

SEARCH_QUERY = 'et contains:ance lang:fr'
query = searchtweets.gen_request_parameters(SEARCH_QUERY, results_per_call=500)
tweets = searchtweets.collect_results(query,
                         max_tweets=500,
                         result_stream_args=search_args)

I use Python 3.6.8.

It is mentionned that Academic Research product track gives access to the full set of search operators, is contains: an exception?

Thanks for your help!

contains: is a PowerTrack only operator Operators by product | Docs | Twitter Developer Platform (these do not apply for Academic Access v2 API, but there are a few overlapping ones.)

These are the only operators valid for v2 Academic Access Search: Search Tweets - How to build a query | Docs | Twitter Developer Platform

2 Likes