Skip to content

Commit a301edf

Browse files
committed
support youtube shorts
1 parent 23de06b commit a301edf

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/services.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
width: 580,
99
},
1010
youtube: {
11-
regex: /(?:https?:\/\/)?(?:www\.)?(?:(?:youtu\.be\/)|(?:youtube\.com)\/(?:v\/|u\/\w\/|embed\/|watch))(?:(?:\?v=)?([^#&?=]*))?((?:[?&]\w*=\w*)*)/,
11+
regex: /(?:https?:\/\/)?(?:www\.)?(?:(?:youtu\.be\/)|(?:youtube\.com)\/(?:v\/|u\/\w\/|embed\/|watch|shorts\/))(?:(?:\?v=)?([^#&?=]*))?((?:[?&]\w*=\w*)*)/,
1212
embedUrl: 'https://www.youtube.com/embed/<%= remote_id %>',
1313
html: '<iframe style="width:100%;" height="320" frameborder="0" allowfullscreen></iframe>',
1414
height: 320,

test/services.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ describe('Services Regexps', () => {
2525
{ source: 'https://www.youtube.com/watch?v=efBBjIK3b8I&list=LL&t=1337', embed: 'https://www.youtube.com/embed/efBBjIK3b8I?start=1337' },
2626
{ source: 'https://www.youtube.com/watch?v=yQUeAin7fII&list=RDMMnMXCzscqi_M', embed: 'https://www.youtube.com/embed/yQUeAin7fII?' },
2727
{ source: 'https://www.youtube.com/watch?v=3kw2sttGXMI&list=FLgc4xqIMDoiP4KOTFS21TJA', embed: 'https://www.youtube.com/embed/3kw2sttGXMI?' },
28+
{ source: 'https://youtube.com/shorts/iMRAY06BJN0', embed: 'https://www.youtube.com/embed/iMRAY06BJN0' },
29+
{ source: 'https://youtube.com/shorts/iMRAY06BJN0?feature=share', embed: 'https://www.youtube.com/embed/iMRAY06BJN0?' }
2830
];
2931

3032
urls.forEach(url => {

0 commit comments

Comments
 (0)