Skip to content

links to youtube channels are being embedded #48

@barisusakli

Description

@barisusakli

Sample post content

Conclusion: youtube links to channel sub-links with more than 5 characters are invalid.

https://www.youtube.com/@domegaia/about
https://www.youtube.com/@domegaia
https://www.youtube.com/@domegaia/chann
https://www.youtube.com/@domegaia/12345
https://www.youtube.com/@domegaia/123456
https://www.youtube.com/@domegaia/abouts
https://www.youtube.com/@domegaia/channels
https://www.youtube.com/@domegaia/community
https://www.youtube.com/@domegaia/abc123
https://www.youtube.com/@domegaia/shorts

https://www.youtube.com/@domegaia/featured

https://www.youtube.com/@domegaia/videos

The youtube regex matches the links that have more than 5 characters at the end.

image

I changed the regex and added @ like so (?:<a.*?)?(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?!user|channel|@)\S*(?:(?:\/e(?:mbed))?\/|watch\?(?:\S*?&?v\=))|youtu\.be\/)([a-zA-Z0-9_-]{6,11})(?:.*?\/a>)?

Not sure if it's the best way or if you want to handle it differently. As far as I can see these are not links to videos so they shouldn't turn into embeds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions