[go] Fix _VALID_URL

Closes #255
This commit is contained in:
pukkandan 2021-04-21 15:40:55 +05:30
parent ab406a1c0e
commit 3b4775e021
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698

View file

@ -8,6 +8,8 @@
int_or_none, int_or_none,
determine_ext, determine_ext,
parse_age_limit, parse_age_limit,
remove_start,
remove_end,
urlencode_postdata, urlencode_postdata,
ExtractorError, ExtractorError,
) )
@ -46,15 +48,15 @@ class GoIE(AdobePassIE):
} }
_VALID_URL = r'''(?x) _VALID_URL = r'''(?x)
https?:// https?://
(?: (?P<sub_domain>
(?:(?P<sub_domain>%s)\.)?go| (?:%s\.)?go|fxnow\.fxnetworks|
(?P<sub_domain_2>abc|freeform|disneynow|fxnow\.fxnetworks) (?:www\.)?(?:abc|freeform|disneynow)
)\.com/ )\.com/
(?: (?:
(?:[^/]+/)*(?P<id>[Vv][Dd][Kk][Aa]\w+)| (?:[^/]+/)*(?P<id>[Vv][Dd][Kk][Aa]\w+)|
(?:[^/]+/)*(?P<display_id>[^/?\#]+) (?:[^/]+/)*(?P<display_id>[^/?\#]+)
) )
''' % '|'.join(list(_SITE_INFO.keys())) ''' % r'\.|'.join(list(_SITE_INFO.keys()))
_TESTS = [{ _TESTS = [{
'url': 'http://abc.go.com/shows/designated-survivor/video/most-recent/VDKA3807643', 'url': 'http://abc.go.com/shows/designated-survivor/video/most-recent/VDKA3807643',
'info_dict': { 'info_dict': {
@ -133,6 +135,9 @@ class GoIE(AdobePassIE):
}, { }, {
'url': 'https://disneynow.com/shows/minnies-bow-toons/video/happy-campers/vdka4872013', 'url': 'https://disneynow.com/shows/minnies-bow-toons/video/happy-campers/vdka4872013',
'only_matching': True, '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'): 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): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, 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') video_id, display_id = mobj.group('id', 'display_id')
site_info = self._SITE_INFO.get(sub_domain, {}) site_info = self._SITE_INFO.get(sub_domain, {})
brand = site_info.get('brand') brand = site_info.get('brand')