Skip to content

Commit

Permalink
Merge pull request #100 from fishchev/master
Browse files Browse the repository at this point in the history
Ignore 'list' parameter if it's known to break YouTube embed
  • Loading branch information
neSpecc committed Sep 7, 2022
2 parents 27e5789 28953e4 commit 64884ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 42,12 @@ export default {
return null;
}

if (value === 'LL'
|| value.startsWith('RDMM')
|| value.startsWith('FL')) {
return null;
}

return `${paramsMap[name]}=${value}`;
})
.filter(param => !!param);
Expand Down
5 changes: 4 additions & 1 deletion test/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 21,10 @@ describe('Services Regexps', () => {
const urls = [
{ source: 'https://www.youtube.com/watch?v=wZZ7oFKsKzY&t=120', embed: 'https://www.youtube.com/embed/wZZ7oFKsKzY?start=120' },
{ source: 'https://www.youtube.com/embed/_q51LZ2HpbE?list=PLLy6qvPKpdlV3OAw00EuZMoYPz4pYuwuN', embed: 'https://www.youtube.com/embed/_q51LZ2HpbE?list=PLLy6qvPKpdlV3OAw00EuZMoYPz4pYuwuN' },
{ source: 'https://www.youtube.com/watch?time_continue=173&v=Nd9LbCWpHp8', embed: 'https://www.youtube.com/embed/Nd9LbCWpHp8?start=173' }
{ source: 'https://www.youtube.com/watch?time_continue=173&v=Nd9LbCWpHp8', embed: 'https://www.youtube.com/embed/Nd9LbCWpHp8?start=173' },
{ source: 'https://www.youtube.com/watch?v=efBBjIK3b8I&list=LL&t=1337', embed: 'https://www.youtube.com/embed/efBBjIK3b8I?start=1337' },
{ source: 'https://www.youtube.com/watch?v=yQUeAin7fII&list=RDMMnMXCzscqi_M', embed: 'https://www.youtube.com/embed/yQUeAin7fII?' },
{ source: 'https://www.youtube.com/watch?v=3kw2sttGXMI&list=FLgc4xqIMDoiP4KOTFS21TJA', embed: 'https://www.youtube.com/embed/3kw2sttGXMI?' },
];

urls.forEach(url => {
Expand Down

0 comments on commit 64884ac

Please sign in to comment.