]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/abcotvs.py
2 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from ..compat
import compat_str
14 class ABCOTVSIE(InfoExtractor
):
16 IE_DESC
= 'ABC Owned Television Stations'
17 _VALID_URL
= r
'https?://(?P<site>abc(?:7(?:news|ny|chicago)?|11|13|30)|6abc)\.com(?:(?:/[^/]+)*/(?P<display_id>[^/]+))?/(?P<id>\d+)'
20 'url': 'http://abc7news.com/entertainment/east-bay-museum-celebrates-vintage-synthesizers/472581/',
23 'display_id': 'east-bay-museum-celebrates-vintage-synthesizers',
25 'title': 'East Bay museum celebrates synthesized music',
26 'description': 'md5:24ed2bd527096ec2a5c67b9d5a9005f3',
27 'thumbnail': r
're:^https?://.*\.jpg$',
28 'timestamp': 1421118520,
29 'upload_date': '20150113',
33 'skip_download': True,
37 'url': 'http://abc7news.com/472581',
38 'only_matching': True,
41 'url': 'https://6abc.com/man-75-killed-after-being-struck-by-vehicle-in-chester/5725182/',
42 'only_matching': True,
56 def _real_extract(self
, url
):
57 site
, display_id
, video_id
= self
._match
_valid
_url
(url
).groups()
58 display_id
= display_id
or video_id
59 station
= self
._SITE
_MAP
[site
]
61 data
= self
._download
_json
(
62 'https://api.abcotvs.com/v2/content', display_id
, query
={
64 'key': 'otv.web.%s.story' % station
,
67 video
= try_get(data
, lambda x
: x
['featuredMedia']['video'], dict) or data
68 video_id
= compat_str(dict_get(video
, ('id', 'publishedKey'), video_id
))
69 title
= video
.get('title') or video
['linkText']
72 m3u8_url
= video
.get('m3u8')
74 formats
= self
._extract
_m
3u8_formats
(
75 video
['m3u8'].split('?')[0], display_id
, 'mp4', m3u8_id
='hls', fatal
=False)
76 mp4_url
= video
.get('mp4')
85 self
._sort
_formats
(formats
)
87 image
= video
.get('image') or {}
91 'display_id': display_id
,
93 'description': dict_get(video
, ('description', 'caption'), try_get(video
, lambda x
: x
['meta']['description'])),
94 'thumbnail': dict_get(image
, ('source', 'dynamicSource')),
95 'timestamp': int_or_none(video
.get('date')),
96 'duration': int_or_none(video
.get('length')),
101 class ABCOTVSClipsIE(InfoExtractor
):
102 IE_NAME
= 'abcotvs:clips'
103 _VALID_URL
= r
'https?://clips\.abcotvs\.com/(?:[^/]+/)*video/(?P<id>\d+)'
105 'url': 'https://clips.abcotvs.com/kabc/video/214814',
109 'title': 'SpaceX launch pad explosion destroys rocket, satellite',
110 'description': 'md5:9f186e5ad8f490f65409965ee9c7be1b',
111 'upload_date': '20160901',
112 'timestamp': 1472756695,
116 'skip_download': True,
120 def _real_extract(self
, url
):
121 video_id
= self
._match
_id
(url
)
122 video_data
= self
._download
_json
('https://clips.abcotvs.com/vogo/video/getByIds?ids=' + video_id
, video_id
)['results'][0]
123 title
= video_data
['title']
124 formats
= self
._extract
_m
3u8_formats
(
125 video_data
['videoURL'].split('?')[0], video_id
, 'mp4')
126 self
._sort
_formats
(formats
)
131 'description': video_data
.get('description'),
132 'thumbnail': video_data
.get('thumbnailURL'),
133 'duration': int_or_none(video_data
.get('duration')),
134 'timestamp': int_or_none(video_data
.get('pubDate')),