2 from __future__ import unicode_literals
4 from .common import InfoExtractor
5 from ..compat import compat_urlparse
13 class MusicPlayOnIE(InfoExtractor):
14 _VALID_URL = r'https?://(?:.+?\.)?musicplayon\.com/play(?:-touch)?\?(?:v|pl=100&play)=(?P<id>\d+)'
17 'url': 'http://en.musicplayon.com/play?v=433377',
18 'md5': '00cdcdea1726abdf500d1e7fd6dd59bb',
22 'title': 'Rick Ross - Interview On Chelsea Lately (2014)',
23 'description': 'Rick Ross Interview On Chelsea Lately',
25 'uploader': 'ultrafish',
29 def _real_extract(self, url):
30 video_id = self._match_id(url)
32 page = self._download_webpage(url, video_id)
34 title = self._og_search_title(page)
35 description = self._og_search_description(page)
36 thumbnail = self._og_search_thumbnail(page)
37 duration = self._html_search_meta('video:duration', page, 'duration', fatal=False)
38 view_count = self._og_search_property('count', page, fatal=False)
39 uploader = self._html_search_regex(
40 r'<div>by <a href="[^"]+" class="purple">([^<]+)</a></div>', page, 'uploader', fatal=False)
42 sources = self._parse_json(
43 self._search_regex(r'setup\[\'_sources\'\]\s*=\s*([^;]+);', page, 'video sources'),
44 video_id, transform_source=js_to_json)
46 'url': compat_urlparse.urljoin(url, source['src']),
47 'ext': mimetype2ext(source.get('type')),
48 'format_note': source.get('data-res'),
49 } for source in sources]
54 'description': description,
55 'thumbnail': thumbnail,
57 'duration': int_or_none(duration),
58 'view_count': int_or_none(view_count),