Add check for streamUrl
This commit is contained in:
parent
78d635a002
commit
dd5e389739
2 changed files with 4 additions and 1 deletions
|
@ -130,7 +130,7 @@ async function lookupTrack(id) {
|
||||||
type: 'track',
|
type: 'track',
|
||||||
id: song_meta.videoId,
|
id: song_meta.videoId,
|
||||||
name: song_meta.title,
|
name: song_meta.title,
|
||||||
streamUrl: null,
|
streamUrl: `https://music.youtube.com/watch?v=${song_meta.videoId}`,
|
||||||
purchaseUrl: null,
|
purchaseUrl: null,
|
||||||
artwork,
|
artwork,
|
||||||
artist: {
|
artist: {
|
||||||
|
@ -184,6 +184,7 @@ async function lookupAlbum(id) {
|
||||||
id,
|
id,
|
||||||
name: album_data.title,
|
name: album_data.title,
|
||||||
streamUrl: null,
|
streamUrl: null,
|
||||||
|
streamUrl: `https://music.youtube.com/browse/${id}`,
|
||||||
purchaseUrl: null,
|
purchaseUrl: null,
|
||||||
artwork,
|
artwork,
|
||||||
artist: {
|
artist: {
|
||||||
|
|
|
@ -37,10 +37,12 @@ describe('ytmusic', function(){
|
||||||
it('should parse track url into ID', async function (){
|
it('should parse track url into ID', async function (){
|
||||||
const result = await ytmusic.parseUrl('https://music.youtube.com/watch?v=YLp2cW7ICCU&feature=share');
|
const result = await ytmusic.parseUrl('https://music.youtube.com/watch?v=YLp2cW7ICCU&feature=share');
|
||||||
result.id.should.equal("YLp2cW7ICCU");
|
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 (){
|
it('should parse album url into ID', async function (){
|
||||||
const result = await ytmusic.parseUrl('https://music.youtube.com/browse/MPREb_9C36yscfgmJ');
|
const result = await ytmusic.parseUrl('https://music.youtube.com/browse/MPREb_9C36yscfgmJ');
|
||||||
result.id.should.equal("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 (){
|
it('should parse alternative album url into ID', async function (){
|
||||||
const result = await ytmusic.parseUrl('https://music.youtube.com/playlist?list=OLAK5uy_lx9K5RpiBEwd3E4C1GKqY7e06qTlwydvs');
|
const result = await ytmusic.parseUrl('https://music.youtube.com/playlist?list=OLAK5uy_lx9K5RpiBEwd3E4C1GKqY7e06qTlwydvs');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue