Add check for streamUrl

This commit is contained in:
Renato "Lond" Cerqueira 2021-01-17 12:05:16 +01:00
parent 78d635a002
commit dd5e389739
2 changed files with 4 additions and 1 deletions

View file

@ -130,7 +130,7 @@ async function lookupTrack(id) {
type: 'track',
id: song_meta.videoId,
name: song_meta.title,
streamUrl: null,
streamUrl: `https://music.youtube.com/watch?v=${song_meta.videoId}`,
purchaseUrl: null,
artwork,
artist: {
@ -184,6 +184,7 @@ async function lookupAlbum(id) {
id,
name: album_data.title,
streamUrl: null,
streamUrl: `https://music.youtube.com/browse/${id}`,
purchaseUrl: null,
artwork,
artist: {

View file

@ -37,10 +37,12 @@ describe('ytmusic', function(){
it('should parse track url into ID', async function (){
const result = await ytmusic.parseUrl('https://music.youtube.com/watch?v=YLp2cW7ICCU&feature=share');
result.id.should.equal("YLp2cW7ICCU");
result.streamUrl.should.equal("https://music.youtube.com/watch?v=YLp2cW7ICCU");
});
it('should parse album url into ID', async function (){
const result = await ytmusic.parseUrl('https://music.youtube.com/browse/MPREb_9C36yscfgmJ');
result.id.should.equal("MPREb_9C36yscfgmJ");
result.streamUrl.should.equal("https://music.youtube.com/browse/MPREb_9C36yscfgmJ");
});
it('should parse alternative album url into ID', async function (){
const result = await ytmusic.parseUrl('https://music.youtube.com/playlist?list=OLAK5uy_lx9K5RpiBEwd3E4C1GKqY7e06qTlwydvs');