Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

links to youtube channels are being embedded #48

Open
barisusakli opened this issue Jan 24, 2023 · 0 comments
Open

links to youtube channels are being embedded #48

barisusakli opened this issue Jan 24, 2023 · 0 comments

Comments

@barisusakli
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant