Skip to content

Commit f133bda

Browse files
authored
Merge pull request #638 from tcely/patch-4
Add youtube.com as a valid domain
2 parents a6e7eec + 1671c6e commit f133bda

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tubesync/sync/views.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,15 @@ class ValidateSourceView(FormView):
193193
Source.SOURCE_TYPE_YOUTUBE_PLAYLIST: ('https://www.youtube.com/playlist?list='
194194
'PL590L5WQmH8dpP0RyH5pCfIaDEdt9nk7r')
195195
}
196+
_youtube_domains = frozenset({
197+
'youtube.com',
198+
'm.youtube.com',
199+
'www.youtube.com',
200+
})
196201
validation_urls = {
197202
Source.SOURCE_TYPE_YOUTUBE_CHANNEL: {
198203
'scheme': 'https',
199-
'domains': ('m.youtube.com', 'www.youtube.com'),
204+
'domains': _youtube_domains,
200205
'path_regex': '^\/(c\/)?([^\/]+)(\/videos)?$',
201206
'path_must_not_match': ('/playlist', '/c/playlist'),
202207
'qs_args': [],
@@ -205,7 +210,7 @@ class ValidateSourceView(FormView):
205210
},
206211
Source.SOURCE_TYPE_YOUTUBE_CHANNEL_ID: {
207212
'scheme': 'https',
208-
'domains': ('m.youtube.com', 'www.youtube.com'),
213+
'domains': _youtube_domains,
209214
'path_regex': '^\/channel\/([^\/]+)(\/videos)?$',
210215
'path_must_not_match': ('/playlist', '/c/playlist'),
211216
'qs_args': [],
@@ -214,7 +219,7 @@ class ValidateSourceView(FormView):
214219
},
215220
Source.SOURCE_TYPE_YOUTUBE_PLAYLIST: {
216221
'scheme': 'https',
217-
'domains': ('m.youtube.com', 'www.youtube.com'),
222+
'domains': _youtube_domains,
218223
'path_regex': '^\/(playlist|watch)$',
219224
'path_must_not_match': (),
220225
'qs_args': ('list',),

0 commit comments

Comments
 (0)