]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/expotv.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
10 class ExpoTVIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?expotv\.com/videos/[^?#]*/(?P<id>[0-9]+)($|[?#])'
13 'url': 'http://www.expotv.com/videos/reviews/3/40/NYX-Butter-lipstick/667916',
14 'md5': 'fe1d728c3a813ff78f595bc8b7a707a8',
18 'title': 'NYX Butter Lipstick Little Susie',
19 'description': 'Goes on like butter, but looks better!',
20 'thumbnail': 're:^https?://.*\.jpg$',
21 'uploader': 'Stephanie S.',
22 'upload_date': '20150520',
27 def _real_extract(self
, url
):
28 video_id
= self
._match
_id
(url
)
30 webpage
= self
._download
_webpage
(url
, video_id
)
31 player_key
= self
._search
_regex
(
32 r
'<param name="playerKey" value="([^"]+)"', webpage
, 'player key')
33 config
= self
._download
_json
(
34 'http://client.expotv.com/video/config/%s/%s' % (video_id
, player_key
),
35 video_id
, 'Downloading video configuration')
38 for fcfg
in config
['sources']:
39 media_url
= fcfg
.get('file')
42 if fcfg
.get('type') == 'm3u8':
43 formats
.extend(self
._extract
_m
3u8_formats
(
44 media_url
, video_id
, 'mp4', entry_protocol
='m3u8_native', m3u8_id
='hls'))
48 'height': int_or_none(fcfg
.get('height')),
49 'format_id': fcfg
.get('label'),
50 'ext': self
._search
_regex
(
51 r
'filename=.*\.([a-z0-9_A-Z]+)&', media_url
,
52 'file extension', default
=None) or fcfg
.get('type'),
54 self
._sort
_formats
(formats
)
56 title
= self
._og
_search
_title
(webpage
)
57 description
= self
._og
_search
_description
(webpage
)
58 thumbnail
= config
.get('image')
59 view_count
= int_or_none(self
._search
_regex
(
60 r
'<h5>Plays: ([0-9]+)</h5>', webpage
, 'view counts'))
61 uploader
= self
._search
_regex
(
62 r
'<div class="reviewer">\s*<img alt="([^"]+)"', webpage
, 'uploader',
64 upload_date
= unified_strdate(self
._search
_regex
(
65 r
'<h5>Reviewed on ([0-9/.]+)</h5>', webpage
, 'upload date',
66 fatal
=False), day_first
=False)
72 'description': description
,
73 'view_count': view_count
,
74 'thumbnail': thumbnail
,
76 'upload_date': upload_date
,