Comments (8)
@LittleWhole can you provide an example of the song you were trying to search?
from genius-lyrics-api.
@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 getLyrics()
function, not the searchSong()
function, sorry
from genius-lyrics-api.
@LittleWhole I cannot reproduce this. getLyrics
method works fine with both URLs and returns the correct lyrics.
Can you share some more info like code samples and lib version?
from genius-lyrics-api.
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 });
}
});
};
from genius-lyrics-api.
@LittleWhole what's the value of songInfo.title
? Also can you attach a catch method with the getLyrics
call and confirm that the error is being thrown by getLyrics
and not something else in your code?
from genius-lyrics-api.
@farshed
In this test, songInfo.title
should be 朴樹 - 平凡之路 [歌詞字幕][電影《後會無期》主題曲][完整高清音質] The Continent Theme Song - The Ordinary Road (Pu Shu)
.
Here's the catch
output of the error:
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]: }
from genius-lyrics-api.
The error is caused by the presence of special characters like [
and ]
in the title. I've released a patch which encodes these special characters before making a request.
Do note that searching 朴樹 - 平凡之路 [歌詞字幕][電影《後會無期》主題曲][完整高清音質] The Continent Theme Song - The Ordinary Road (Pu Shu)
on genius.com doesn't return any results so the lib will return null
. See https://genius.com/search?q=%E6%9C%B4%E6%A8%B9%20-%20%E5%B9%B3%E5%87%A1%E4%B9%8B%E8%B7%AF%20%5B%E6%AD%8C%E8%A9%9E%E5%AD%97%E5%B9%95%5D%5B%E9%9B%BB%E5%BD%B1%E3%80%8A%E5%BE%8C%E6%9C%83%E7%84%A1%E6%9C%9F%E3%80%8B%E4%B8%BB%E9%A1%8C%E6%9B%B2%5D%5B%E5%AE%8C%E6%95%B4%E9%AB%98%E6%B8%85%E9%9F%B3%E8%B3%AA%5D%20The%20Continent%20Theme%20Song%20-%20The%20Ordinary%20Road%20
from genius-lyrics-api.
@farshed Thank you, I understand 😃
from genius-lyrics-api.
Related Issues (20)
- CORS issue on the app deployed to Heroku HOT 1
- Network Error (Access Control Checks) in production (not localhost) HOT 8
- Axios dependency security vulnerability HOT 1
- The searchSong() method is not working properly with special characters. HOT 1
- Please add support for optional genius api host address HOT 10
- Can't fetch lyrics HOT 2
- getSongById documentation incorrect HOT 1
- Implementing entirely on front end HOT 1
- 403 on Server but not on my Desktop HOT 6
- get lyric with id problem
- Error 403 (Captcha) HOT 5
- CORS issue HOT 4
- getSongById 401 response HOT 1
- getLyrics broken for some Genuis lyrics pages HOT 1
- Question: How can I export this library as a module to be used inside a webpage? HOT 1
- Issue: Missing CORS ('Access-Control-Allow-Origin') on deployed website. HOT 3
- Confused about the implementation HOT 15
- Getting a weird page from law.justia.com instead of lyrics HOT 6
- Keep getting a 401 error HOT 1
- Lyrics longer than 4000 characters aren't returned HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from genius-lyrics-api.