mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-30 21:12:54 +01:00
[abcotvs] extend _VALID_URL and add support for clips.abcotvs.com(closes #9551)
This commit is contained in:
parent
bc22a79694
commit
0b36a96212
@ -1,13 +1,18 @@
|
|||||||
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import parse_iso8601
|
from ..utils import (
|
||||||
|
int_or_none,
|
||||||
|
parse_iso8601,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Abc7NewsIE(InfoExtractor):
|
class ABCOTVSIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://abc7news\.com(?:/[^/]+/(?P<display_id>[^/]+))?/(?P<id>\d+)'
|
IE_NAME = 'abcotvs'
|
||||||
|
_VALID_URL = r'https?://(?:abc(?:7(?:news|ny|chicago)?|11|13|30)|6abc)\.com(?:/[^/]+/(?P<display_id>[^/]+))?/(?P<id>\d+)'
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
'url': 'http://abc7news.com/entertainment/east-bay-museum-celebrates-vintage-synthesizers/472581/',
|
'url': 'http://abc7news.com/entertainment/east-bay-museum-celebrates-vintage-synthesizers/472581/',
|
||||||
@ -15,7 +20,7 @@ class Abc7NewsIE(InfoExtractor):
|
|||||||
'id': '472581',
|
'id': '472581',
|
||||||
'display_id': 'east-bay-museum-celebrates-vintage-synthesizers',
|
'display_id': 'east-bay-museum-celebrates-vintage-synthesizers',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'East Bay museum celebrates history of synthesized music',
|
'title': 'East Bay museum celebrates vintage synthesizers',
|
||||||
'description': 'md5:a4f10fb2f2a02565c1749d4adbab4b10',
|
'description': 'md5:a4f10fb2f2a02565c1749d4adbab4b10',
|
||||||
'thumbnail': 're:^https?://.*\.jpg$',
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
'timestamp': 1421123075,
|
'timestamp': 1421123075,
|
||||||
@ -41,7 +46,7 @@ class Abc7NewsIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, display_id)
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
|
||||||
m3u8 = self._html_search_meta(
|
m3u8 = self._html_search_meta(
|
||||||
'contentURL', webpage, 'm3u8 url', fatal=True)
|
'contentURL', webpage, 'm3u8 url', fatal=True).split('?')[0]
|
||||||
|
|
||||||
formats = self._extract_m3u8_formats(m3u8, display_id, 'mp4')
|
formats = self._extract_m3u8_formats(m3u8, display_id, 'mp4')
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
@ -66,3 +71,41 @@ class Abc7NewsIE(InfoExtractor):
|
|||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class ABCOTVSClipsIE(InfoExtractor):
|
||||||
|
IE_NAME = 'abcotvs:clips'
|
||||||
|
_VALID_URL = r'https?://clips\.abcotvs\.com/(?:[^/]+/)*video/(?P<id>\d+)'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'https://clips.abcotvs.com/kabc/video/214814',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '214814',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'SpaceX launch pad explosion destroys rocket, satellite',
|
||||||
|
'description': 'md5:9f186e5ad8f490f65409965ee9c7be1b',
|
||||||
|
'upload_date': '20160901',
|
||||||
|
'timestamp': 1472756695,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
# m3u8 download
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
video_id = self._match_id(url)
|
||||||
|
video_data = self._download_json('https://clips.abcotvs.com/vogo/video/getByIds?ids=' + video_id, video_id)['results'][0]
|
||||||
|
title = video_data['title']
|
||||||
|
formats = self._extract_m3u8_formats(
|
||||||
|
video_data['videoURL'].split('?')[0], video_id, 'mp4')
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'description': video_data.get('description'),
|
||||||
|
'thumbnail': video_data.get('thumbnailURL'),
|
||||||
|
'duration': int_or_none(video_data.get('duration')),
|
||||||
|
'timestamp': int_or_none(video_data.get('pubDate')),
|
||||||
|
'formats': formats,
|
||||||
|
}
|
@ -5,11 +5,14 @@ from .abc import (
|
|||||||
ABCIE,
|
ABCIE,
|
||||||
ABCIViewIE,
|
ABCIViewIE,
|
||||||
)
|
)
|
||||||
from .abc7news import Abc7NewsIE
|
|
||||||
from .abcnews import (
|
from .abcnews import (
|
||||||
AbcNewsIE,
|
AbcNewsIE,
|
||||||
AbcNewsVideoIE,
|
AbcNewsVideoIE,
|
||||||
)
|
)
|
||||||
|
from .abcotvs import (
|
||||||
|
ABCOTVSIE,
|
||||||
|
ABCOTVSClipsIE,
|
||||||
|
)
|
||||||
from .academicearth import AcademicEarthCourseIE
|
from .academicearth import AcademicEarthCourseIE
|
||||||
from .acast import (
|
from .acast import (
|
||||||
ACastIE,
|
ACastIE,
|
||||||
|
Loading…
Reference in New Issue
Block a user