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 {
|
try {
|
||||||
const { hostname, pathname, searchParams } = new URL(href)
|
const { hostname, pathname, searchParams } = new URL(href)
|
||||||
|
|
||||||
if (hostname.endsWith('youtube.com') && pathname.includes('/watch')) {
|
if (hostname.endsWith('youtube.com')) {
|
||||||
return {
|
if (pathname.includes('/watch')) {
|
||||||
provider: 'youtube',
|
return {
|
||||||
id: searchParams.get('v'),
|
provider: 'youtube',
|
||||||
meta: {
|
id: searchParams.get('v'),
|
||||||
href,
|
meta: {
|
||||||
start: searchParams.get('t')
|
href,
|
||||||
|
start: searchParams.get('t')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pathname.includes('/shorts')) {
|
||||||
|
const id = pathname.split('/').slice(-1).join()
|
||||||
|
return {
|
||||||
|
provider: 'youtube',
|
||||||
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user