YouTube Music as supported player (#3736)

zio/stable
Mary 2024-04-28 12:11:08 +07:00 committed by GitHub
parent 21e5a87fab
commit 74cd1d4458
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -396,6 +396,7 @@ describe('parseEmbedPlayerFromUrl', () => {
'https://youtube.com/watch?v=videoId&feature=share', 'https://youtube.com/watch?v=videoId&feature=share',
'https://youtube.com/shorts/videoId', 'https://youtube.com/shorts/videoId',
'https://m.youtube.com/watch?v=videoId', 'https://m.youtube.com/watch?v=videoId',
'https://music.youtube.com/watch?v=videoId',
'https://youtube.com/shorts/', 'https://youtube.com/shorts/',
'https://youtube.com/', 'https://youtube.com/',
@ -504,6 +505,11 @@ describe('parseEmbedPlayerFromUrl', () => {
source: 'youtube', source: 'youtube',
playerUri: 'https://bsky.app/iframe/youtube.html?videoId=videoId&start=0', 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,
undefined, undefined,

View File

@ -95,7 +95,8 @@ export function parseEmbedPlayerFromUrl(
if ( if (
urlp.hostname === 'www.youtube.com' || urlp.hostname === 'www.youtube.com' ||
urlp.hostname === '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 [_, page, shortVideoId] = urlp.pathname.split('/')
const videoId = const videoId =