I keep getting the above error (HTTP status code 403) when using the search API. I’m using Python with Tweepy’s Cursor which implements this algorithm: https://dev.twitter.com/rest/public/timelines. I also implemented it on my own and got the same error. It only happens with some of the queries I make.
Example failing query:
q: -RT (("Spectre" OR #Spectre) AND (film OR movie OR poster OR trailer OR bond OR "Daniel Craig" OR DanielCraig OR "Christoph Waltz" OR ChristophWaltz OR "Lea Seydoux" OR LeaSeydoux OR "Monica Bellucci" OR MonicaBellucci OR "Andrew Scott" OR AndrewScott OR "Dave Bautista" OR DaveBautista OR "Ralph Fiennes" OR RalphFiennes OR "Naomie Harris" OR NaomieHarris OR "Ben Whishaw" OR BenWhishaw OR "Rory Kinnear" OR RoryKinnear OR "007")) OR (("Spectre" OR #Spectre) AND (@007))
lang: en
max_id: 666389911482814466
which results in a following URL:
https://api.twitter.com/1.1/search/tweets.json?q=-RT%20((%22Spectre%22%20OR%20%23Spectre)%20AND%20(film%20OR%20movie%20OR%20poster%20OR%20trailer%20OR%20bond%20OR%20%22Daniel%20Craig%22%20OR%20DanielCraig%20OR%20%22Christoph%20Waltz%22%20OR%20ChristophWaltz%20OR%20%22Lea%20Seydoux%22%20OR%20LeaSeydoux%20OR%20%22Monica%20Bellucci%22%20OR%20MonicaBellucci%20OR%20%22Andrew%20Scott%22%20OR%20AndrewScott%20OR%20%22Dave%20Bautista%22%20OR%20DaveBautista%20OR%20%22Ralph%20Fiennes%22%20OR%20RalphFiennes%20OR%20%22Naomie%20Harris%22%20OR%20NaomieHarris%20OR%20%22Ben%20Whishaw%22%20OR%20BenWhishaw%20OR%20%22Rory%20Kinnear%22%20OR%20RoryKinnear%20OR%20%22007%22))%20OR%20((%22Spectre%22%20OR%20%23Spectre)%20AND%20(%40007))&lang=en&max_id=666389911482814466
Tried it both using Tweepy and through https://dev.twitter.com/rest/tools/console. The result is the same.
The query length is well below the 1000 characters limit but maybe it’s still too complex? Removing a few of the ORs seems to help but I feel reluctant to call it a solution without some kind of confirmation.