]>
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': '3316ff838ae5bb7f642537825e1e90d2', 
  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."', 
  41             'timestamp': 1429467813, 
  42             'upload_date': '20150419', 
  43             'uploader_id': 'batchUser', 
  47     def _real_extract(self
, url
): 
  48         video_id 
= self
._match
_id
(url
) 
  50         webpage 
= self
._download
_webpage
(url
, video_id
) 
  51         embedded_video_info 
= self
._parse
_json
(self
._html
_search
_regex
( 
  52             r
'tmzVideoEmbed\(({.+?})\);', webpage
, 'embedded video info'), 
  55         return self
.url_result( 
  56             'http://www.tmz.com/videos/%s/' % embedded_video_info
['id'])