- qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
- video_id = qs.get('prgid', [None])[0]
- user_id = qs.get('ch_userid', [None])[0]
- if any(not f for f in (video_id, user_id,)):
- raise ExtractorError('Invalid URL', expected=True)
+ mobj = re.match(self._VALID_URL, url)
+ user_id = mobj.group('user_id')
+ video_id = mobj.group('id')
+
+ if not user_id or not video_id:
+ qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
+ video_id = qs.get('prgid', [None])[0]
+ user_id = qs.get('ch_userid', [None])[0]
+ if any(not f for f in (video_id, user_id,)):
+ raise ExtractorError('Invalid URL', expected=True)