Twitter API Relationship Operator not working

I am using the Twitters search API (via the node-twitter module ) and I ran into a problem with the relation operator. I am looking to get both positive and negative tweets about a particular subject. They are currently returning the same results. Here is my code that calls the API.

// Add since ID for future requests
twitterSearchClient.search(
    {'q'          :'xmas+%3A%28',
     'lang'       : 'en',
     'count'      : 100,
     'result_type': 'recent'},
    function(error, result) {
        if (error) {
            console.log('Error: ' + (error.code ? error.code + ' ' + error.message : error.message));
        }

        if (result) {
            var requestDetails = result.search_metadata;
            var results = result.statuses;
            var resultsLength = results.length;
            var r;
            var data;
            var d;

            console.log(resultsLength);

            for (var i=0; i<resultsLength; i++) {

               console.log(r.text);
            }   
        }
    }
);

As you can see, I use a fully urlencoded value, as an example in the documentation. I also tried using xmas +% 3A) for positive and xmas +% 3A (for negative, but for some reason returns 401 unauthorized error.

Has anyone encountered this problem or had a solution.

If you have any future questions, I will be happy to answer them.

Thanks in advance.

+4
2

docs

, , URL ,

url xmas :),

https://twitter.com/search?q=xmas%20%3A)

, xmas :)= xmas%20%3A) xmas :(

https://twitter.com/search?q=xmas%20%3A(

xmas :(= xmas%20%3A(

- ( , ), , , , . , .

+1

? .

...
'q': 'xmas :(',
...

. twitter ( npm?), .


, , , URI... , encodeURIComponent('xmas :)') , .

+1

Source: https://habr.com/ru/post/1569088/


All Articles