Skip to content

Commit

Permalink
Also convert YouTube playlist links in alternate format (#53)
Browse files Browse the repository at this point in the history
* Also convert YouTube playlist links in alternate format

* Fix eslint error: remove unnecessary \
  • Loading branch information
Siilwyn authored and jbmoelker committed Feb 14, 2019
1 parent 07b6c01 commit 48e7018
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/url-matchers.js
Expand Up @@ -8,7 +8,7 @@ const getYoutubeUrlId = pipe([
]);

const getYoutubePlaylistUrlId = pipe([
match(/^https:\/\/w*\.*youtube\.com\/playlist\?list=(\w{18})/),
match(/^https:\/\/w*\.*youtube\.com\/playlist\?list=([\w\d-]+)/),
chain(match => match.groups[0]),
]);

Expand Down
8 changes: 8 additions & 0 deletions src/url-matchers.test.js
Expand Up @@ -86,4 +86,12 @@ test('getYoutubePlaylistUrlId', t => {
Just('PL597E0BDDC1D74ED2'),
'matches complete youtube playlist url with extra characters'
);

t.deepEqual(
urlMatchers.getYoutubePlaylistUrlId(
'https://www.youtube.com/playlist?list=PLcp2b-TPWnAc-W2EFGMV9yDcNbjWZucqZ'
),
Just('PLcp2b-TPWnAc-W2EFGMV9yDcNbjWZucqZ'),
'matches alternate youtube playlist url'
);
});

0 comments on commit 48e7018

Please sign in to comment.