]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/musicplayon.py
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=\d+&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',
28 'url': 'http://en.musicplayon.com/play?pl=102&play=442629',
29 'only_matching': True,
32 _URL_TEMPLATE
= 'http://en.musicplayon.com/play?v=%s'
34 def _real_extract(self
, url
):
35 video_id
= self
._match
_id
(url
)
36 url
= self
._URL
_TEMPLATE
% video_id
38 page
= self
._download
_webpage
(url
, video_id
)
40 title
= self
._og
_search
_title
(page
)
41 description
= self
._og
_search
_description
(page
)
42 thumbnail
= self
._og
_search
_thumbnail
(page
)
43 duration
= self
._html
_search
_meta
('video:duration', page
, 'duration', fatal
=False)
44 view_count
= self
._og
_search
_property
('count', page
, fatal
=False)
45 uploader
= self
._html
_search
_regex
(
46 r
'<div>by <a href="[^"]+" class="purple">([^<]+)</a></div>', page
, 'uploader', fatal
=False)
48 sources
= self
._parse
_json
(
49 self
._search
_regex
(r
'setup\[\'_sources
\'\
]\s
*=\s
*([^
;]+);', page, 'video sources
'),
50 video_id, transform_source=js_to_json)
52 'url
': compat_urlparse.urljoin(url, source['src
']),
53 'ext
': mimetype2ext(source.get('type')),
54 'format_note
': source.get('data
-res
'),
55 } for source in sources]
60 'description
': description,
61 'thumbnail
': thumbnail,
63 'duration
': int_or_none(duration),
64 'view_count
': int_or_none(view_count),