get time from youtube links
This commit is contained in:
parent
0f4d44cfa6
commit
48448ea1ef
|
@ -71,11 +71,18 @@ function ItemEmbed ({ item }) {
|
|||
)
|
||||
}
|
||||
|
||||
const youtube = item.url?.match(/(https?:\/\/)?((www\.)?(youtube(-nocookie)?|youtube.googleapis)\.com.*(v\/|v=|vi=|vi\/|e\/|embed\/|user\/.*\/u\/\d+\/)|youtu\.be\/)(?<id>[_0-9a-z-]+)/i)
|
||||
const youtube = item.url?.match(/(https?:\/\/)?((www\.)?(youtube(-nocookie)?|youtube.googleapis)\.com.*(v\/|v=|vi=|vi\/|e\/|embed\/|user\/.*\/u\/\d+\/)|youtu\.be\/)(?<id>[_0-9a-z-]+)((?:\?|&)(?:t|start)=(?<start>\d+))?/i)
|
||||
if (youtube?.groups?.id) {
|
||||
console.log(youtube?.groups?.start)
|
||||
return (
|
||||
<div style={{ maxWidth: '640px', paddingRight: '15px' }}>
|
||||
<YouTube videoId={youtube.groups.id} containerClassName={styles.youtubeContainer} />
|
||||
<YouTube
|
||||
videoId={youtube.groups.id} containerClassName={styles.youtubeContainer} opts={{
|
||||
playerVars: {
|
||||
start: youtube?.groups?.start
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue