Support extra youtube embed playlist links (#2972)

* Fix strange embed playlist links missing /

* support embed/videoseries links

* remove duplicated replace line

Co-authored-by: petaded <code@zikl.co.uk>
This commit is contained in:
petaded 2022-12-22 14:22:12 +00:00 committed by GitHub
parent 7ea690bf9d
commit c79674d956
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -292,7 +292,12 @@ const actions = {
// youtube.com/embed
function() {
if (urlObject.pathname.match(/^\/embed\/[A-Za-z0-9_-]+$/)) {
extractParams(urlObject.pathname.replace('/embed/', ''))
const urlTail = urlObject.pathname.replace('/embed/', '')
if (urlTail === 'videoseries') {
paramsObject.playlistId = urlObject.searchParams.get('list')
} else {
extractParams(urlTail)
}
return paramsObject
}
},
@ -366,7 +371,7 @@ const actions = {
/^\/(?:(?<type>channel|user|c)\/)?(?<channelId>[^/]+)(?:\/(join|featured|videos|playlists|about|community|channels))?\/?$/
const typePatterns = new Map([
['playlist', /^\/playlist\/?$/],
['playlist', /^(\/playlist\/?|\/embed(\/?videoseries)?)$/],
['search', /^\/results\/?$/],
['hashtag', /^\/hashtag\/([^/?&#]+)$/],
['channel', channelPattern]