From c0600ff06acd7bc687d9e46667e8a4116d413900 Mon Sep 17 00:00:00 2001 From: TRox1972 Date: Fri, 27 May 2016 13:37:40 +0200 Subject: [PATCH 1/2] [GodTV] Add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/godtv.py | 31 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 youtube_dl/extractor/godtv.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 05561149a..2ad9ac5bc 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -289,6 +289,7 @@ from .globo import ( GloboArticleIE, ) from .godtube import GodTubeIE +from .godtv import GodTVIE from .goldenmoustache import GoldenMoustacheIE from .golem import GolemIE from .googledrive import GoogleDriveIE diff --git a/youtube_dl/extractor/godtv.py b/youtube_dl/extractor/godtv.py new file mode 100644 index 000000000..a57b17b03 --- /dev/null +++ b/youtube_dl/extractor/godtv.py @@ -0,0 +1,31 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re +from .common import InfoExtractor +from .ooyala import OoyalaIE + + +class GodTVIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?god\.tv(?:/[a-z0-9-]+)+/(?P[a-z0-9-]+)' + _TEST = { + 'url': 'http://god.tv/jesus-image/video/jesus-conference-2016/randy-needham', + 'info_dict': { + 'id': 'lpd3g2MzE6D1g8zFAKz8AGpxWcpu6o_3', + 'ext': 'mp4', + 'title': 'Randy Needham', + 'duration': 3615.08, + }, + 'params': { + 'skip_download': True, + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + display_id = mobj.group('display_id') + + webpage = self._download_webpage(url, display_id) + ooyala_id = self._search_regex(r'"content_id"\s*:\s*"([\w-]{32})"', webpage, display_id) + + return OoyalaIE._build_url_result(ooyala_id) From 3a7788cbdd8e78dddff993beb29b1f76a700c24d Mon Sep 17 00:00:00 2001 From: TRox1972 Date: Thu, 9 Jun 2016 12:51:47 +0200 Subject: [PATCH 2/2] [GodTV] Improvements --- youtube_dl/extractor/godtv.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/godtv.py b/youtube_dl/extractor/godtv.py index a57b17b03..50f093ace 100644 --- a/youtube_dl/extractor/godtv.py +++ b/youtube_dl/extractor/godtv.py @@ -1,13 +1,12 @@ # coding: utf-8 from __future__ import unicode_literals -import re from .common import InfoExtractor from .ooyala import OoyalaIE class GodTVIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?god\.tv(?:/[a-z0-9-]+)+/(?P[a-z0-9-]+)' + _VALID_URL = r'https?://(?:www\.)?god\.tv(?:/[^/]+)+/(?P[^/?#&]+)' _TEST = { 'url': 'http://god.tv/jesus-image/video/jesus-conference-2016/randy-needham', 'info_dict': { @@ -22,8 +21,7 @@ class GodTVIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) - display_id = mobj.group('display_id') + display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) ooyala_id = self._search_regex(r'"content_id"\s*:\s*"([\w-]{32})"', webpage, display_id)