]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/abcotvs.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class ABCOTVSIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:abc(?:7(?:news|ny|chicago)?|11|13|30)|6abc)\.com(?:/[^/]+/(?P<display_id>[^/]+))?/(?P<id>\d+)'
18 'url': 'http://abc7news.com/entertainment/east-bay-museum-celebrates-vintage-synthesizers/472581/',
21 'display_id': 'east-bay-museum-celebrates-vintage-synthesizers',
23 'title': 'East Bay museum celebrates vintage synthesizers',
24 'description': 'md5:a4f10fb2f2a02565c1749d4adbab4b10',
25 'thumbnail': 're:^https?://.*\.jpg$',
26 'timestamp': 1421123075,
27 'upload_date': '20150113',
28 'uploader': 'Jonathan Bloom',
32 'skip_download': True,
36 'url': 'http://abc7news.com/472581',
37 'only_matching': True,
41 def _real_extract(self
, url
):
42 mobj
= re
.match(self
._VALID
_URL
, url
)
43 video_id
= mobj
.group('id')
44 display_id
= mobj
.group('display_id') or video_id
46 webpage
= self
._download
_webpage
(url
, display_id
)
48 m3u8
= self
._html
_search
_meta
(
49 'contentURL', webpage
, 'm3u8 url', fatal
=True).split('?')[0]
51 formats
= self
._extract
_m
3u8_formats
(m3u8
, display_id
, 'mp4')
52 self
._sort
_formats
(formats
)
54 title
= self
._og
_search
_title
(webpage
).strip()
55 description
= self
._og
_search
_description
(webpage
).strip()
56 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
57 timestamp
= parse_iso8601(self
._search
_regex
(
58 r
'<div class="meta">\s*<time class="timeago" datetime="([^"]+)">',
59 webpage
, 'upload date', fatal
=False))
60 uploader
= self
._search
_regex
(
61 r
'rel="author">([^<]+)</a>',
62 webpage
, 'uploader', default
=None)
66 'display_id': display_id
,
68 'description': description
,
69 'thumbnail': thumbnail
,
70 'timestamp': timestamp
,
76 class ABCOTVSClipsIE(InfoExtractor
):
77 IE_NAME
= 'abcotvs:clips'
78 _VALID_URL
= r
'https?://clips\.abcotvs\.com/(?:[^/]+/)*video/(?P<id>\d+)'
80 'url': 'https://clips.abcotvs.com/kabc/video/214814',
84 'title': 'SpaceX launch pad explosion destroys rocket, satellite',
85 'description': 'md5:9f186e5ad8f490f65409965ee9c7be1b',
86 'upload_date': '20160901',
87 'timestamp': 1472756695,
91 'skip_download': True,
95 def _real_extract(self
, url
):
96 video_id
= self
._match
_id
(url
)
97 video_data
= self
._download
_json
('https://clips.abcotvs.com/vogo/video/getByIds?ids=' + video_id
, video_id
)['results'][0]
98 title
= video_data
['title']
99 formats
= self
._extract
_m
3u8_formats
(
100 video_data
['videoURL'].split('?')[0], video_id
, 'mp4')
101 self
._sort
_formats
(formats
)
106 'description': video_data
.get('description'),
107 'thumbnail': video_data
.get('thumbnailURL'),
108 'duration': int_or_none(video_data
.get('duration')),
109 'timestamp': int_or_none(video_data
.get('pubDate')),