-
hello! I'm trying to search, but i'm finding that the search query has no results while the web version of twitter does. const client = new TwitterApi(TWITTER_BEARER_TOKEN).readWrite; I'm searching with: const results = await client.search(fixedEncodeURIComponent("steam://rungame/730")); fixedEncodeURIComponent is defined as: function fixedEncodeURIComponent(str: string) {
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
});
} From my understanding, this is supposed to be a safer version of If I don't include this, I get the error message, Upon doing this, no results are returned, whereas the web version does have results. I'm not sure if this is just caused by searching differences in the web version vs the API, or if I'm doing something wrong, But any guidance in the right direction will be very appreciated :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi :) Some characters have a special meaning in Twitter Search API, including const results = await client.search('steam"://"rungame"/"730'); If your search is made to match exactly what you've specified, you can directly wrap everything into quotes: const results = await client.search('"steam://rungame/730"'); A correct URL-encoding is already made by the lib, you don't need to do it by yourself :) |
Beta Was this translation helpful? Give feedback.
Hi :)
Some characters have a special meaning in Twitter Search API, including
/
and:
.You need to wrap them into quotes:
If your search is made to match exactly what you've specified, you can directly wrap everything into quotes:
A correct URL-encoding is already made by the lib, you don't need to do it by yourself :)