2014-04-02 10:10:20 -05:00
|
|
|
# encoding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
2016-04-17 02:08:51 -05:00
|
|
|
from ..compat import compat_urlparse
|
|
|
|
from ..utils import (
|
|
|
|
int_or_none,
|
|
|
|
js_to_json,
|
|
|
|
mimetype2ext,
|
|
|
|
)
|
2014-04-02 10:10:20 -05:00
|
|
|
|
|
|
|
|
|
|
|
class MusicPlayOnIE(InfoExtractor):
|
|
|
|
_VALID_URL = r'https?://(?:.+?\.)?musicplayon\.com/play(?:-touch)?\?(?:v|pl=100&play)=(?P<id>\d+)'
|
|
|
|
|
|
|
|
_TEST = {
|
|
|
|
'url': 'http://en.musicplayon.com/play?v=433377',
|
2016-04-17 02:08:51 -05:00
|
|
|
'md5': '00cdcdea1726abdf500d1e7fd6dd59bb',
|
2014-04-02 10:10:20 -05:00
|
|
|
'info_dict': {
|
|
|
|
'id': '433377',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Rick Ross - Interview On Chelsea Lately (2014)',
|
|
|
|
'description': 'Rick Ross Interview On Chelsea Lately',
|
|
|
|
'duration': 342,
|
|
|
|
'uploader': 'ultrafish',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2016-04-17 02:08:51 -05:00
|
|
|
video_id = self._match_id(url)
|
2014-04-02 10:10:20 -05:00
|
|
|
|
|
|
|
page = self._download_webpage(url, video_id)
|
|
|
|
|
|
|
|
title = self._og_search_title(page)
|
|
|
|
description = self._og_search_description(page)
|
|
|
|
thumbnail = self._og_search_thumbnail(page)
|
|
|
|
duration = self._html_search_meta('video:duration', page, 'duration', fatal=False)
|
|
|
|
view_count = self._og_search_property('count', page, fatal=False)
|
|
|
|
uploader = self._html_search_regex(
|
|
|
|
r'<div>by <a href="[^"]+" class="purple">([^<]+)</a></div>', page, 'uploader', fatal=False)
|
|
|
|
|
2016-04-17 02:08:51 -05:00
|
|
|
sources = self._parse_json(
|
|
|
|
self._search_regex(r'setup\[\'_sources\'\]\s*=\s*([^;]+);', page, 'video sources'),
|
|
|
|
video_id, transform_source=js_to_json)
|
|
|
|
formats = [{
|
|
|
|
'url': compat_urlparse.urljoin(url, source['src']),
|
|
|
|
'ext': mimetype2ext(source.get('type')),
|
|
|
|
'format_note': source.get('data-res'),
|
|
|
|
} for source in sources]
|
2014-04-02 10:10:20 -05:00
|
|
|
|
|
|
|
return {
|
|
|
|
'id': video_id,
|
|
|
|
'title': title,
|
|
|
|
'description': description,
|
|
|
|
'thumbnail': thumbnail,
|
|
|
|
'uploader': uploader,
|
|
|
|
'duration': int_or_none(duration),
|
|
|
|
'view_count': int_or_none(view_count),
|
|
|
|
'formats': formats,
|
2014-11-23 13:41:03 -06:00
|
|
|
}
|