Parse channel handles in video descriptions (#3011)

This commit is contained in:
absidue 2022-12-31 11:07:53 +01:00 committed by GitHub
parent 5d1f465bf5
commit 2f01dd4277
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -904,8 +904,14 @@ export default Vue.extend({
} else {
// Some YouTube URLs don't have the urlEndpoint so we handle them here
const path = part.navigationEndpoint.commandMetadata.webCommandMetadata.url
return `https://www.youtube.com${path}`
const { browseEndpoint, commandMetadata: { webCommandMetadata } } = part.navigationEndpoint
// channel handle
if (webCommandMetadata.webPageType === 'WEB_PAGE_TYPE_CHANNEL' && part.text.startsWith('@')) {
return `<a href="https://www.youtube.com/channel/${browseEndpoint.browseId}">${part.text}</a>`
} else {
const path = webCommandMetadata.url
return `https://www.youtube.com${path}`
}
}
},