Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search returns zero results #74

Open
GonyRosenman opened this issue Sep 28, 2023 · 1 comment
Open

search returns zero results #74

GonyRosenman opened this issue Sep 28, 2023 · 1 comment

Comments

@GonyRosenman
Copy link

GonyRosenman commented Sep 28, 2023

hello dear people,
as the name suggests, i try to run a simple script to search for a song ('like a virgin' for example) and get zero results for my search.
i have a username and password.

here's the script:

const slsk = require('slsk-client');

const USERNAME = '**********'; 
const PASSWORD = '**********'; 

slsk.connect({
  user: USERNAME,
  pass: PASSWORD
}, (err, client) => {
  if (err) {
    console.error("Error connecting to Soulseek:", err);
    return;
  }
  
  const searchTerm = 'like a virgin';
  client.search({
    req: searchTerm,
    timeout: 2000
  }, (err, res) => {
    if (err) {
      console.error(`Error searching for "${searchTerm}":`, err);
      return;
    }
    if (res && res.length) {
      client.download({
        file: res[0],
        path: `./downloads/${searchTerm}.mp3`
      }, (err) => {
        if (err) {
          console.error(`Error downloading "${searchTerm}":`, err);
        } else {
          console.log(`Successfully downloaded "${searchTerm}"`);
        }
      });
    } else {
      console.log(`No results found for "${searchTerm}"`);
    }
  });
});

i get the output no results found and then the program simply hangs until i ctrl+c

I have access to my router's settings and can configure port forwarding, but I'm not entirely sure how to set it up specifically for this module. Could you provide some guidance on:

Does the slsk-client use a specific port for incoming connections that I should forward?
If so, which port is it, and should I set it for TCP, UDP, or both?

If the port is dynamic or if there's any other configuration I should be aware of to optimize search results, could you please guide me on that as well?

Do you think the issue can arise from something else but port forwarding?

I'd really appreciate any help or insights you can provide. I'm excited about using the module but am currently stuck due to this issue.

Thank you!

@GonyRosenman
Copy link
Author

i managed to solve the issue by checking the UpNp igd box on.
i still struggle to download songs as it takes a really long time.

Error downloading "move your body": Error: Peer error
at Messages. (C:\Users\97254\auto_soulseek\slsk-client-master\node_modules\slsk-client\lib\peer\default-peer.js:114:21)
at Messages.emit (node:events:517:28)
at Messages.read (C:\Users\97254\auto_soulseek\slsk-client-master\node_modules\slsk-client\lib\messages.js:20:12)
at Messages._write (C:\Users\97254\auto_soulseek\slsk-client-master\node_modules\slsk-client\lib\messages.js:6:10)
at writeOrBuffer (node:internal/streams/writable:392:12)
at _write (node:internal/streams/writable:333:10)
at Writable.write (node:internal/streams/writable:337:10)
at Socket. (C:\Users\97254\auto_soulseek\slsk-client-master\node_modules\slsk-client\lib\peer\default-peer.js:24:12)
at Socket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:335:12)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant