]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tmz.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
7 class TMZIE(InfoExtractor
):
8 _VALID_URL
= r
'https?://(?:www\.)?tmz\.com/videos/(?P<id>[^/?#]+)'
10 'url': 'http://www.tmz.com/videos/0_okj015ty/',
11 'md5': '4d22a51ef205b6c06395d8394f72d560',
15 'title': 'Kim Kardashian\'s Boobs Unlock a Mystery!',
16 'description': 'Did Kim Kardasain try to one-up Khloe by one-upping Kylie??? Or is she just showing off her amazing boobs?',
17 'timestamp': 1394747163,
18 'uploader_id': 'batchUser',
19 'upload_date': '20140313',
22 'url': 'http://www.tmz.com/videos/0-cegprt2p/',
23 'only_matching': True,
26 def _real_extract(self
, url
):
27 video_id
= self
._match
_id
(url
).replace('-', '_')
28 return self
.url_result('kaltura:591531:%s' % video_id
, 'Kaltura', video_id
)
31 class TMZArticleIE(InfoExtractor
):
32 _VALID_URL
= r
'https?://(?:www\.)?tmz\.com/\d{4}/\d{2}/\d{2}/(?P<id>[^/]+)/?'
34 'url': 'http://www.tmz.com/2015/04/19/bobby-brown-bobbi-kristina-awake-video-concert',
35 'md5': 'e482a414a38db73087450e3a6ce69d00',
39 'title': 'Bobby Brown Tells Crowd ... Bobbi Kristina is Awake',
40 'description': 'Bobby Brown stunned his audience during a concert Saturday night, when he told the crowd, "Bobbi is awake. She\'s watching me."',
44 def _real_extract(self
, url
):
45 video_id
= self
._match
_id
(url
)
47 webpage
= self
._download
_webpage
(url
, video_id
)
48 embedded_video_info_str
= self
._html
_search
_regex
(
49 r
'tmzVideoEmbedV2\("([^)]+)"\);', webpage
, 'embedded video info')
51 embedded_video_info
= self
._parse
_json
(
52 embedded_video_info_str
, video_id
,
53 transform_source
=lambda s
: s
.replace('\\', ''))
55 return self
.url_result(
56 'http://www.tmz.com/videos/%s/' % embedded_video_info
['id'])