support youtube channels without vanity URLs, resolves #6

This commit is contained in:
meeb 2020-12-18 12:30:31 +11:00
parent c1c39d9e17
commit ffe0049bab
2 changed files with 4 additions and 1 deletions

View File

@ -35,6 +35,9 @@ class FrontEndTestCase(TestCase):
'valid': (
'https://www.youtube.com/testchannel',
'https://www.youtube.com/c/testchannel',
'https://www.youtube.com/c/testchannel/videos',
'https://www.youtube.com/channel/testchannel',
'https://www.youtube.com/channel/testchannel/videos',
),
'invalid_schema': (
'http://www.youtube.com/c/playlist',

View File

@ -157,7 +157,7 @@ class ValidateSourceView(FormView):
Source.SOURCE_TYPE_YOUTUBE_CHANNEL: {
'scheme': 'https',
'domain': 'www.youtube.com',
'path_regex': '^\/(c\/)?([^\/]+)$',
'path_regex': '^\/(c\/|channel\/)?([^\/]+)(\/videos)?$',
'path_must_not_match': ('/playlist', '/c/playlist'),
'qs_args': [],
'extract_key': ('path_regex', 1),