-
Notifications
You must be signed in to change notification settings - Fork 37
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
Throws a "UnhandledPromiseRejectionWarning: TypeError [ERR_UNESCAPED_CHARACTERS]" when trying to search for Chinese, Japanese, Hebrew, or Arabic lyrics #5
Comments
@LittleWhole can you provide an example of the song you were trying to search? |
@farshed Sure! Chinese: https://genius.com/Pu-shu--lyrics Japanese: https://genius.com/Mrs-green-apple-tenbyou-no-uta-lyrics By the way, I should probably clarify that I am using the |
@LittleWhole I cannot reproduce this. Can you share some more info like code samples and lib version? |
Lib version: 3.0.1 Code context: This is a lyrics command in a Discord bot. const genius = require('genius-lyrics-api');
const Discord = require('discord.js')
exports.run = async (client, message, command, args, perms, config) => {
let thisConnection = client.voice.connections.find(connection => connection.channel.guild === message.guild)
let songInfo = thisConnection.dispatcher.songInfo();
let options = {
apiKey: config.apikeys.genius,
title: songInfo.title,
artist: "",
optimizeQuery: true
}
genius.getLyrics(options).then((lyrics) => {
let lyricsEmbed;
for (let i = 0; i < lyrics.length; i += 2048) {
const toSend = lyrics.substring(i, Math.min(lyrics.length, i + 2048));
lyricsEmbed = new Discord.MessageEmbed()
.setDescription(toSend)
.setColor(config.colors.blue);
message.channel.send({ embed: lyricsEmbed });
}
});
}; |
@LittleWhole what's the value of |
@farshed 2020-06-28T14:19:02.960979+00:00 app[worker.1]: TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters
2020-06-28T14:19:02.960995+00:00 app[worker.1]: at new ClientRequest (_http_client.js:151:13)
2020-06-28T14:19:02.960996+00:00 app[worker.1]: at Object.request (https.js:310:10)
2020-06-28T14:19:02.960996+00:00 app[worker.1]: at RedirectableRequest._performRequest (/app/node_modules/follow-redirects/index.js:169:24)
2020-06-28T14:19:02.960997+00:00 app[worker.1]: at new RedirectableRequest (/app/node_modules/follow-redirects/index.js:66:8)
2020-06-28T14:19:02.960997+00:00 app[worker.1]: at Object.wrappedProtocol.request (/app/node_modules/follow-redirects/index.js:307:14)
2020-06-28T14:19:02.960998+00:00 app[worker.1]: at dispatchHttpRequest (/app/node_modules/genius-lyrics-api/node_modules/axios/lib/adapters/http.js:179:25)
2020-06-28T14:19:02.961000+00:00 app[worker.1]: at new Promise (<anonymous>)
2020-06-28T14:19:02.961000+00:00 app[worker.1]: at httpAdapter (/app/node_modules/genius-lyrics-api/node_modules/axios/lib/adapters/http.js:21:10)
2020-06-28T14:19:02.961001+00:00 app[worker.1]: at dispatchRequest (/app/node_modules/genius-lyrics-api/node_modules/axios/lib/core/dispatchRequest.js:52:10)
2020-06-28T14:19:02.961001+00:00 app[worker.1]: at runMicrotasks (<anonymous>) {
2020-06-28T14:19:02.961002+00:00 app[worker.1]: code: 'ERR_UNESCAPED_CHARACTERS'
2020-06-28T14:19:02.961003+00:00 app[worker.1]: } |
The error is caused by the presence of special characters like Do note that searching |
@farshed Thank you, I understand 😃 |
I tried to search for Chinese, Japanese, Hebrew, and Arabic lyrics, but when doing so, I get a
UnhandledPromiseRejectionWarning: TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters
.Here's a log:
The text was updated successfully, but these errors were encountered: