1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
13 class MooshareIE(InfoExtractor
):
15 IE_DESC
= 'Mooshare.biz'
16 _VALID_URL
= r
'https?://(?:www\.)?mooshare\.biz/(?P<id>[\da-z]{12})'
20 'url': 'http://mooshare.biz/8dqtk4bjbp8g',
21 'md5': '4e14f9562928aecd2e42c6f341c8feba',
25 'title': 'Comedy Football 2011 - (part 1-2)',
30 'url': 'http://mooshare.biz/aipjtoc4g95j',
34 'title': 'Orange Caramel Dashing Through the Snow',
39 'skip_download': True,
44 def _real_extract(self
, url
):
45 video_id
= self
._match
_id
(url
)
46 page
= self
._download
_webpage
(url
, video_id
, 'Downloading page')
48 if re
.search(r
'>Video Not Found or Deleted<', page
) is not None:
49 raise ExtractorError('Video %s does not exist' % video_id
, expected
=True)
51 hash_key
= self
._html
_search
_regex
(r
'<input type="hidden" name="hash" value="([^"]+)">', page
, 'hash')
52 title
= self
._html
_search
_regex
(r
'(?m)<div class="blockTitle">\s*<h2>Watch ([^<]+)</h2>', page
, 'title')
60 request
= sanitized_Request(
61 'http://mooshare.biz/%s' % video_id
, urlencode_postdata(download_form
))
62 request
.add_header('Content-Type', 'application/x-www-form-urlencoded')
64 self
._sleep
(5, video_id
)
66 video_page
= self
._download
_webpage
(request
, video_id
, 'Downloading video page')
68 thumbnail
= self
._html
_search
_regex
(r
'image:\s*"([^"]+)",', video_page
, 'thumbnail', fatal
=False)
69 duration_str
= self
._html
_search
_regex
(r
'duration:\s*"(\d+)",', video_page
, 'duration', fatal
=False)
70 duration
= int(duration_str
) if duration_str
is not None else None
75 mobj
= re
.search(r
'(?m)file:\s*"(?P<url>[^"]+)",\s*provider:', video_page
)
78 'url': mobj
.group('url'),
84 mobj
= re
.search(r
'\'hd
-2\': { file: \'(?P<url>[^\']+)\' }
,', video_page)
87 'url
': mobj.group('url
'),
93 mobj = re.search(r'(?m
)file: "(?P<playpath>[^"]+)",\s*streamer: "(?P
<rtmpurl
>rtmp
://[^
"]+)",', video_page)
96 'url
': mobj.group('rtmpurl
'),
97 'play_path
': mobj.group('playpath
'),
107 'thumbnail
': thumbnail,
108 'duration
': duration,