Skip to content

Commit

Permalink
YouTube Music as supported player (#3736)
Browse files Browse the repository at this point in the history
  • Loading branch information
mary-ext authored Apr 28, 2024
1 parent 21e5a87 commit 74cd1d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions __tests__/lib/string.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ describe('parseEmbedPlayerFromUrl', () => {
'https://youtube.com/watch?v=videoId&feature=share',
'https://youtube.com/shorts/videoId',
'https://m.youtube.com/watch?v=videoId',
'https://music.youtube.com/watch?v=videoId',

'https://youtube.com/shorts/',
'https://youtube.com/',
Expand Down Expand Up @@ -504,6 +505,11 @@ describe('parseEmbedPlayerFromUrl', () => {
source: 'youtube',
playerUri: 'https://bsky.app/iframe/youtube.html?videoId=videoId&start=0',
},
{
type: 'youtube_video',
source: 'youtube',
playerUri: 'https://bsky.app/iframe/youtube.html?videoId=videoId&start=0',
},

undefined,
undefined,
Expand Down
3 changes: 2 additions & 1 deletion src/lib/strings/embed-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ export function parseEmbedPlayerFromUrl(
if (
urlp.hostname === 'www.youtube.com' ||
urlp.hostname === 'youtube.com' ||
urlp.hostname === 'm.youtube.com'
urlp.hostname === 'm.youtube.com' ||
urlp.hostname === 'music.youtube.com'
) {
const [_, page, shortVideoId] = urlp.pathname.split('/')
const videoId =
Expand Down

0 comments on commit 74cd1d4

Please sign in to comment.