Merge pull request #352 from renatolond/fix_track_search

Fix track search for ytmusic
This commit is contained in:
Jonathan Cremin 2021-06-17 16:50:38 +01:00 committed by GitHub
commit 01b4393ccf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 14 deletions

View file

@ -10,8 +10,25 @@ describe('ytmusic', function(){
it('should find track by ID', async function (){
const result = await ytmusic.lookupId('9zrYXvUXiQk', 'track');
result.name.should.equal('One Vision (Remastered 2011)');
result.name.should.equal('One Vision');
result.artist.name.should.equal('Queen');
result.album.name.should.equal('A Kind Of Magic')
});
it('should find track by ID', async function (){
const result = await ytmusic.lookupId('rAzfNuU1f8E', 'track');
result.name.should.equal('Erre (Live)');
result.artist.name.should.equal('Boogarins');
// The copyright notice is too long and is the only place where the album name is.
result.album.name.should.equal('')
});
it('should find track by ID', async function (){
const result = await ytmusic.lookupId('Wst0la_TgTY', 'track');
result.name.should.equal('Às Vezes Bate Uma Saudade');
// XXX: This is very odd. Sometimes, google will return the first artist "Rodrigo Alarcon", sometimes "Rodrigo Alarcon, Ana Muller & Mariana Froes" and sometimes
// "Rodrigo Alarcon, Ana Muller, Mariana Froes". Same API call, same everything. Go figure.
// result.artist.name.should.equal('Rodrigo Alarcon, Ana Muller, Mariana Froes');
result.artist.name.should.startWith('Rodrigo Alarcon');
result.album.name.should.equal('Taquetá Vol.1')
});
});
describe('search', () => {