From 3b4775e021ebe4c5da43b48bc6484a829f0bb9e2 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Wed, 21 Apr 2021 15:40:55 +0530 Subject: [PATCH] [go] Fix `_VALID_URL` Closes #255 --- yt_dlp/extractor/go.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/yt_dlp/extractor/go.py b/yt_dlp/extractor/go.py index dda08ae3e..c31e07a0c 100644 --- a/yt_dlp/extractor/go.py +++ b/yt_dlp/extractor/go.py @@ -8,6 +8,8 @@ int_or_none, determine_ext, parse_age_limit, + remove_start, + remove_end, urlencode_postdata, ExtractorError, ) @@ -46,15 +48,15 @@ class GoIE(AdobePassIE): } _VALID_URL = r'''(?x) https?:// - (?: - (?:(?P%s)\.)?go| - (?Pabc|freeform|disneynow|fxnow\.fxnetworks) + (?P + (?:%s\.)?go|fxnow\.fxnetworks| + (?:www\.)?(?:abc|freeform|disneynow) )\.com/ (?: (?:[^/]+/)*(?P[Vv][Dd][Kk][Aa]\w+)| (?:[^/]+/)*(?P[^/?\#]+) ) - ''' % '|'.join(list(_SITE_INFO.keys())) + ''' % r'\.|'.join(list(_SITE_INFO.keys())) _TESTS = [{ 'url': 'http://abc.go.com/shows/designated-survivor/video/most-recent/VDKA3807643', 'info_dict': { @@ -133,6 +135,9 @@ class GoIE(AdobePassIE): }, { 'url': 'https://disneynow.com/shows/minnies-bow-toons/video/happy-campers/vdka4872013', 'only_matching': True, + }, { + 'url': 'https://www.freeform.com/shows/cruel-summer/episode-guide/season-01/01-happy-birthday-jeanette-turner', + 'only_matching': True, }] def _extract_videos(self, brand, video_id='-1', show_id='-1'): @@ -143,7 +148,7 @@ def _extract_videos(self, brand, video_id='-1', show_id='-1'): def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) - sub_domain = mobj.group('sub_domain') or mobj.group('sub_domain_2') + sub_domain = remove_start(remove_end(mobj.group('sub_domain') or '', '.go'), 'www.') video_id, display_id = mobj.group('id', 'display_id') site_info = self._SITE_INFO.get(sub_domain, {}) brand = site_info.get('brand')