]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ellentv.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class EllenTVIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?(?:ellentv|ellentube)\.com/videos/(?P<id>[a-z0-9_-]+)'
16 'url': 'http://www.ellentv.com/videos/0-7jqrsr18/',
17 'md5': 'e4af06f3bf0d5f471921a18db5764642',
21 'title': 'What\'s Wrong with These Photos? A Whole Lot',
22 'description': 'md5:35f152dc66b587cf13e6d2cf4fa467f6',
23 'timestamp': 1406876400,
24 'upload_date': '20140801',
27 'url': 'http://ellentube.com/videos/0-dvzmabd5/',
28 'md5': '98238118eaa2bbdf6ad7f708e3e4f4eb',
32 'title': '1 year old twin sister makes her brother laugh',
33 'description': '1 year old twin sister makes her brother laugh',
34 'timestamp': 1419542075,
35 'upload_date': '20141225',
39 def _real_extract(self
, url
):
40 video_id
= self
._match
_id
(url
)
42 webpage
= self
._download
_webpage
(url
, video_id
)
43 video_url
= self
._html
_search
_meta
('VideoURL', webpage
, 'url')
44 title
= self
._og
_search
_title
(webpage
, default
=None) or self
._search
_regex
(
45 r
'pageName\s*=\s*"([^"]+)"', webpage
, 'title')
46 description
= self
._html
_search
_meta
(
47 'description', webpage
, 'description') or self
._og
_search
_description
(webpage
)
48 timestamp
= parse_iso8601(self
._search
_regex
(
49 r
'<span class="publish-date"><time datetime="([^"]+)">',
50 webpage
, 'timestamp'))
56 'description': description
,
57 'timestamp': timestamp
,
61 class EllenTVClipsIE(InfoExtractor
):
62 IE_NAME
= 'EllenTV:clips'
63 _VALID_URL
= r
'https?://(?:www\.)?ellentv\.com/episodes/(?P<id>[a-z0-9_-]+)'
65 'url': 'http://www.ellentv.com/episodes/meryl-streep-vanessa-hudgens/',
67 'id': 'meryl-streep-vanessa-hudgens',
68 'title': 'Meryl Streep, Vanessa Hudgens',
70 'playlist_mincount': 9,
73 def _real_extract(self
, url
):
74 playlist_id
= self
._match
_id
(url
)
76 webpage
= self
._download
_webpage
(url
, playlist_id
)
77 playlist
= self
._extract
_playlist
(webpage
)
82 'title': self
._og
_search
_title
(webpage
),
83 'entries': self
._extract
_entries
(playlist
)
86 def _extract_playlist(self
, webpage
):
87 json_string
= self
._search
_regex
(r
'playerView.addClips\(\[\{(.*?)\}\]\);', webpage
, 'json')
89 return json
.loads("[{" + json_string
+ "}]")
90 except ValueError as ve
:
91 raise ExtractorError('Failed to download JSON', cause
=ve
)
93 def _extract_entries(self
, playlist
):
94 return [self
.url_result(item
['url'], 'EllenTV') for item
in playlist
]