I am trying to curate tweets based on a query, while filtering out retweets, using the requests.get method in Python. I have Premium API access, for which the operator “is:retweet” is permitted as outlined here https://developer.twitter.com/en/docs/tweets/search/overview/premium.
A code snippet:
search_headers = {
‘Authorization’: ‘Bearer {}’.format(access_token)
}
search_url = ‘https://api.twitter.com/1.1/tweets/search/30day/Development.json’
search_params = {
‘query’: “Joe Rogan OR Eminem -is:retweet”,
‘fromDate’: “201802010000”,
‘toDate’: “201802030000”,
‘maxResults’: 50
}
search_resp = requests.get(search_url, headers=search_headers, params=search_params)
tweet_data = search_resp.json()
When I run the Python script, my returned JSON only displays an error: “There were errors processing your request: Reference to invalid operator ‘is:retweet’. Operator is not available in current product or product packaging.”
If I remove the is:retweet operator, the script runs fine and I am returned appropriate JSON results. The results are, as expected, within the last 30 days - so my Premium API privileges seem to be recognized fine.
Why can I not use the “-is:retweet” operator? Am I querying incorrectly, or is there another way to filter out retweets as my results are returned?
I am new to API querying so apologies for lack of insight/knowledge - any help is greatly appreciated!
Thanks