From 0b36a96212861b3fc3f11b26c22216ed3cc4d2ce Mon Sep 17 00:00:00 2001 From: Remita Amine Date: Mon, 5 Sep 2016 13:41:11 +0100 Subject: [abcotvs] extend _VALID_URL and add support for clips.abcotvs.com(closes #9551) --- youtube_dl/extractor/abcotvs.py | 111 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 youtube_dl/extractor/abcotvs.py (limited to 'youtube_dl/extractor/abcotvs.py') diff --git a/youtube_dl/extractor/abcotvs.py b/youtube_dl/extractor/abcotvs.py new file mode 100644 index 000000000..53a900e50 --- /dev/null +++ b/youtube_dl/extractor/abcotvs.py @@ -0,0 +1,111 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import ( + int_or_none, + parse_iso8601, +) + + +class ABCOTVSIE(InfoExtractor): + IE_NAME = 'abcotvs' + _VALID_URL = r'https?://(?:abc(?:7(?:news|ny|chicago)?|11|13|30)|6abc)\.com(?:/[^/]+/(?P[^/]+))?/(?P\d+)' + _TESTS = [ + { + 'url': 'http://abc7news.com/entertainment/east-bay-museum-celebrates-vintage-synthesizers/472581/', + 'info_dict': { + 'id': '472581', + 'display_id': 'east-bay-museum-celebrates-vintage-synthesizers', + 'ext': 'mp4', + 'title': 'East Bay museum celebrates vintage synthesizers', + 'description': 'md5:a4f10fb2f2a02565c1749d4adbab4b10', + 'thumbnail': 're:^https?://.*\.jpg$', + 'timestamp': 1421123075, + 'upload_date': '20150113', + 'uploader': 'Jonathan Bloom', + }, + 'params': { + # m3u8 download + 'skip_download': True, + }, + }, + { + 'url': 'http://abc7news.com/472581', + 'only_matching': True, + }, + ] + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + display_id = mobj.group('display_id') or video_id + + webpage = self._download_webpage(url, display_id) + + m3u8 = self._html_search_meta( + 'contentURL', webpage, 'm3u8 url', fatal=True).split('?')[0] + + formats = self._extract_m3u8_formats(m3u8, display_id, 'mp4') + self._sort_formats(formats) + + title = self._og_search_title(webpage).strip() + description = self._og_search_description(webpage).strip() + thumbnail = self._og_search_thumbnail(webpage) + timestamp = parse_iso8601(self._search_regex( + r'
\s*