Embed youtube shorts (#1225)
This commit is contained in:
parent
23c51df283
commit
79ed07ae74
24
lib/url.js
24
lib/url.js
|
@ -79,13 +79,23 @@ export function parseEmbedUrl (href) {
|
|||
try {
|
||||
const { hostname, pathname, searchParams } = new URL(href)
|
||||
|
||||
if (hostname.endsWith('youtube.com') && pathname.includes('/watch')) {
|
||||
return {
|
||||
provider: 'youtube',
|
||||
id: searchParams.get('v'),
|
||||
meta: {
|
||||
href,
|
||||
start: searchParams.get('t')
|
||||
if (hostname.endsWith('youtube.com')) {
|
||||
if (pathname.includes('/watch')) {
|
||||
return {
|
||||
provider: 'youtube',
|
||||
id: searchParams.get('v'),
|
||||
meta: {
|
||||
href,
|
||||
start: searchParams.get('t')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pathname.includes('/shorts')) {
|
||||
const id = pathname.split('/').slice(-1).join()
|
||||
return {
|
||||
provider: 'youtube',
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue