1 from __future__ import unicode_literals
6 from .common import InfoExtractor
16 class MooshareIE(InfoExtractor):
18 IE_DESC = 'Mooshare.biz'
19 _VALID_URL = r'http://(?:www\.)?mooshare\.biz/(?P<id>[\da-z]{12})'
23 'url': 'http://mooshare.biz/8dqtk4bjbp8g',
24 'md5': '4e14f9562928aecd2e42c6f341c8feba',
28 'title': 'Comedy Football 2011 - (part 1-2)',
33 'url': 'http://mooshare.biz/aipjtoc4g95j',
37 'title': 'Orange Caramel Dashing Through the Snow',
42 'skip_download': True,
47 def _real_extract(self, url):
48 video_id = self._match_id(url)
49 page = self._download_webpage(url, video_id, 'Downloading page')
51 if re.search(r'>Video Not Found or Deleted<', page) is not None:
52 raise ExtractorError('Video %s does not exist' % video_id, expected=True)
54 hash_key = self._html_search_regex(r'<input type="hidden" name="hash" value="([^"]+)">', page, 'hash')
55 title = self._html_search_regex(r'(?m)<div class="blockTitle">\s*<h2>Watch ([^<]+)</h2>', page, 'title')
63 request = compat_urllib_request.Request(
64 'http://mooshare.biz/%s' % video_id, compat_urllib_parse.urlencode(download_form))
65 request.add_header('Content-Type', 'application/x-www-form-urlencoded')
67 self.to_screen('%s: Waiting for timeout' % video_id)
70 video_page = self._download_webpage(request, video_id, 'Downloading video page')
72 thumbnail = self._html_search_regex(r'image:\s*"([^"]+)",', video_page, 'thumbnail', fatal=False)
73 duration_str = self._html_search_regex(r'duration:\s*"(\d+)",', video_page, 'duration', fatal=False)
74 duration = int(duration_str) if duration_str is not None else None
79 mobj = re.search(r'(?m)file:\s*"(?P<url>[^"]+)",\s*provider:', video_page)
82 'url': mobj.group('url'),
88 mobj = re.search(r'\'hd-2\': { file: \'(?P<url>[^\']+)\' },', video_page)
91 'url': mobj.group('url'),
97 mobj = re.search(r'(?m)file: "(?P<playpath>[^"]+)",\s*streamer: "(?P<rtmpurl>rtmp://[^"]+)",', video_page)
100 'url': mobj.group('rtmpurl'),
101 'play_path': mobj.group('playpath'),
111 'thumbnail': thumbnail,
112 'duration': duration,