-class SharedIE(InfoExtractor):
- IE_DESC = 'shared.sx and vivo.sx'
- _VALID_URL = r'https?://(?:shared|vivo)\.sx/(?P<id>[\da-z]{10})'
+class SharedBaseIE(InfoExtractor):
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+
+ webpage, urlh = self._download_webpage_handle(url, video_id)
+
+ if self._FILE_NOT_FOUND in webpage:
+ raise ExtractorError(
+ 'Video %s does not exist' % video_id, expected=True)
+
+ video_url = self._extract_video_url(webpage, video_id, url)
+
+ title = base64.b64decode(self._html_search_meta(
+ 'full:title', webpage, 'title').encode('utf-8')).decode('utf-8')
+ filesize = int_or_none(self._html_search_meta(
+ 'full:size', webpage, 'file size', fatal=False))
+
+ return {
+ 'id': video_id,
+ 'url': video_url,
+ 'ext': 'mp4',
+ 'filesize': filesize,
+ 'title': title,
+ }
+
+
+class SharedIE(SharedBaseIE):
+ IE_DESC = 'shared.sx'
+ _VALID_URL = r'https?://shared\.sx/(?P<id>[\da-z]{10})'
+ _FILE_NOT_FOUND = '>File does not exist<'