]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/abcotvs.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  13 class ABCOTVSIE(InfoExtractor
): 
  15     IE_DESC 
= 'ABC Owned Television Stations' 
  16     _VALID_URL 
= r
'https?://(?:abc(?:7(?:news|ny|chicago)?|11|13|30)|6abc)\.com(?:/[^/]+/(?P<display_id>[^/]+))?/(?P<id>\d+)' 
  19             'url': 'http://abc7news.com/entertainment/east-bay-museum-celebrates-vintage-synthesizers/472581/', 
  22                 'display_id': 'east-bay-museum-celebrates-vintage-synthesizers', 
  24                 'title': 'East Bay museum celebrates vintage synthesizers', 
  25                 'description': 'md5:24ed2bd527096ec2a5c67b9d5a9005f3', 
  26                 'thumbnail': r
're:^https?://.*\.jpg$', 
  27                 'timestamp': 1421123075, 
  28                 'upload_date': '20150113', 
  29                 'uploader': 'Jonathan Bloom', 
  33                 'skip_download': True, 
  37             'url': 'http://abc7news.com/472581', 
  38             'only_matching': True, 
  42     def _real_extract(self
, url
): 
  43         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  44         video_id 
= mobj
.group('id') 
  45         display_id 
= mobj
.group('display_id') or video_id
 
  47         webpage 
= self
._download
_webpage
(url
, display_id
) 
  49         m3u8 
= self
._html
_search
_meta
( 
  50             'contentURL', webpage
, 'm3u8 url', fatal
=True).split('?')[0] 
  52         formats 
= self
._extract
_m
3u8_formats
(m3u8
, display_id
, 'mp4') 
  53         self
._sort
_formats
(formats
) 
  55         title 
= self
._og
_search
_title
(webpage
).strip() 
  56         description 
= self
._og
_search
_description
(webpage
).strip() 
  57         thumbnail 
= self
._og
_search
_thumbnail
(webpage
) 
  58         timestamp 
= parse_iso8601(self
._search
_regex
( 
  59             r
'<div class="meta">\s*<time class="timeago" datetime="([^"]+)">', 
  60             webpage
, 'upload date', fatal
=False)) 
  61         uploader 
= self
._search
_regex
( 
  62             r
'rel="author">([^<]+)</a>', 
  63             webpage
, 'uploader', default
=None) 
  67             'display_id': display_id
, 
  69             'description': description
, 
  70             'thumbnail': thumbnail
, 
  71             'timestamp': timestamp
, 
  77 class ABCOTVSClipsIE(InfoExtractor
): 
  78     IE_NAME 
= 'abcotvs:clips' 
  79     _VALID_URL 
= r
'https?://clips\.abcotvs\.com/(?:[^/]+/)*video/(?P<id>\d+)' 
  81         'url': 'https://clips.abcotvs.com/kabc/video/214814', 
  85             'title': 'SpaceX launch pad explosion destroys rocket, satellite', 
  86             'description': 'md5:9f186e5ad8f490f65409965ee9c7be1b', 
  87             'upload_date': '20160901', 
  88             'timestamp': 1472756695, 
  92             'skip_download': True, 
  96     def _real_extract(self
, url
): 
  97         video_id 
= self
._match
_id
(url
) 
  98         video_data 
= self
._download
_json
('https://clips.abcotvs.com/vogo/video/getByIds?ids=' + video_id
, video_id
)['results'][0] 
  99         title 
= video_data
['title'] 
 100         formats 
= self
._extract
_m
3u8_formats
( 
 101             video_data
['videoURL'].split('?')[0], video_id
, 'mp4') 
 102         self
._sort
_formats
(formats
) 
 107             'description': video_data
.get('description'), 
 108             'thumbnail': video_data
.get('thumbnailURL'), 
 109             'duration': int_or_none(video_data
.get('duration')), 
 110             'timestamp': int_or_none(video_data
.get('pubDate')),