From cd381738a616d0de907c52de7c1f510c73a74f50 Mon Sep 17 00:00:00 2001 From: John Hawkinson Date: Thu, 6 Oct 2016 01:29:58 -0400 Subject: [PATCH 1/3] Case-insensitive URL match via suitable() Cherry-picked from bca0b731c41adeb689dbb119f8ee60fded5fa251 on my iqm2 branch --- youtube_dl/extractor/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index da192728f..572f91221 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -327,7 +327,7 @@ class InfoExtractor(object): # we have cached the regexp for *this* class, whereas getattr would also # match the superclass if '_VALID_URL_RE' not in cls.__dict__: - cls._VALID_URL_RE = re.compile(cls._VALID_URL) + cls._VALID_URL_RE = re.compile(cls._VALID_URL, flags=re.IGNORECASE) return cls._VALID_URL_RE.match(url) is not None @classmethod From b9ede2fe9ee1e8ae9d1f50f904cd4907e8bee74d Mon Sep 17 00:00:00 2001 From: John Hawkinson Date: Sun, 9 Oct 2016 01:26:02 -0400 Subject: [PATCH 2/3] Revert "Case-insensitive URL match via suitable()" This reverts commit cd381738a616d0de907c52de7c1f510c73a74f50. dstftw commented in #10854 that he thinks this is the wrong way to go. --- youtube_dl/extractor/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 572f91221..da192728f 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -327,7 +327,7 @@ class InfoExtractor(object): # we have cached the regexp for *this* class, whereas getattr would also # match the superclass if '_VALID_URL_RE' not in cls.__dict__: - cls._VALID_URL_RE = re.compile(cls._VALID_URL, flags=re.IGNORECASE) + cls._VALID_URL_RE = re.compile(cls._VALID_URL) return cls._VALID_URL_RE.match(url) is not None @classmethod From 8b0c5de72417e10e10f130260c653cd8300ade3c Mon Sep 17 00:00:00 2001 From: John Hawkinson Date: Sun, 9 Oct 2016 01:31:25 -0400 Subject: [PATCH 3/3] Recommend case-insentitive _VALID_URL matching --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4debe15fe..147016860 100644 --- a/README.md +++ b/README.md @@ -954,7 +954,7 @@ After you have ensured this site is distributing it's content legally, you can f class YourExtractorIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?yourextractor\.com/watch/(?P[0-9]+)' + _VALID_URL = r'(?i)https?://(?:www\.)?yourextractor\.com/watch/(?P[0-9]+)' _TEST = { 'url': 'http://yourextractor.com/watch/42', 'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)',