masto.js
masto.js copied to clipboard
No result provided from search() method
Hi.
I am trying to get results from masto.search() but I get no result under accounts/hashtags/statuses returned by the function.
Here is the code:
const r = await masto.search({
q: "booteille"
}).next()
if (r) {
console.log(r.done)
console.log(r.value)
}
Here are console logs:
false
Object { accounts: [], statuses: [], hashtags: [] }
Did I do something wrong? I tried with 3 different keywords, I have results for each with the user logged in on Mastodon interface. App has global read permissions.
Thanks.
Thank you for reporting the issue. Unfortunately, the code you provided has worked without any problem on my instance.
Firstly, could you try the exact same keyword in the Web interface and verify with a network inspector that the request to /api/v2/search
returns the results you expect? The masto.search
method corresponds to the search bar in the very left column.

Also, I'm not very familiar with how WebFinger works, but since Web UI always specifies resolve
param described in this page, adding resolve: true
would also help you get the same result as the Web UI.
const r = await masto.search({
q: "booteille"
+ resolve: true
}).next()
Hi!
Thanks for your fast answer.
Unfortunately, using resolve did not work neither. The API does not seem to return wanted results.
After investigating, I found the request does not seem to contain the q
parameter (neither the resolve one, when I add it).
Editing through Firefox dev tools the request to add the parameter returns results as intented.
Any idea why it's not working on my case?
I believe this issue is fixed by #700. If you think you still have a problem, feel free to reopen it.