]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/expotv.py
1585a03bb9235a520c63e84c306294f6958dfe13
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
12 class ExpoTVIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://www\.expotv\.com/videos/[^?#]*/(?P<id>[0-9]+)($|[?#])'
15 'url': 'http://www.expotv.com/videos/reviews/1/24/LinneCardscom/17561',
16 'md5': '2985e6d7a392b2f7a05e0ca350fe41d0',
20 'upload_date': '20060212',
21 'title': 'My Favorite Online Scrapbook Store',
23 'description': 'You\'ll find most everything you need at this virtual store front.',
24 'uploader': 'Anna T.',
25 'thumbnail': 're:^https?://.*\.jpg$',
29 def _real_extract(self
, url
):
30 mobj
= re
.match(self
._VALID
_URL
, url
)
31 video_id
= mobj
.group('id')
33 webpage
= self
._download
_webpage
(url
, video_id
)
34 player_key
= self
._search
_regex
(
35 r
'<param name="playerKey" value="([^"]+)"', webpage
, 'player key')
36 config
= self
._download
_json
(
37 'http://client.expotv.com/video/config/%s/%s' % (video_id
, player_key
),
38 video_id
, 'Downloading video configuration')
41 for fcfg
in config
['sources']:
42 media_url
= fcfg
.get('file')
45 if fcfg
.get('type') == 'm3u8':
46 formats
.extend(self
._extract
_m
3u8_formats
(
47 media_url
, video_id
, 'mp4', entry_protocol
='m3u8_native', m3u8_id
='hls'))
51 'height': int_or_none(fcfg
.get('height')),
52 'format_id': fcfg
.get('label'),
53 'ext': self
._search
_regex
(
54 r
'filename=.*\.([a-z0-9_A-Z]+)&', media_url
,
55 'file extension', default
=None) or fcfg
.get('type'),
57 self
._sort
_formats
(formats
)
59 title
= self
._og
_search
_title
(webpage
)
60 description
= self
._og
_search
_description
(webpage
)
61 thumbnail
= config
.get('image')
62 view_count
= int_or_none(self
._search
_regex
(
63 r
'<h5>Plays: ([0-9]+)</h5>', webpage
, 'view counts'))
64 uploader
= self
._search
_regex
(
65 r
'<div class="reviewer">\s*<img alt="([^"]+)"', webpage
, 'uploader',
67 upload_date
= unified_strdate(self
._search
_regex
(
68 r
'<h5>Reviewed on ([0-9/.]+)</h5>', webpage
, 'upload date',
75 'description': description
,
76 'view_count': view_count
,
77 'thumbnail': thumbnail
,
79 'upload_date': upload_date
,