From 8b44c56f62ce6420eda21f381cd91cb90ee1c620 Mon Sep 17 00:00:00 2001 From: dennistobar Date: Tue, 2 Oct 2018 12:33:39 -0300 Subject: [PATCH] [Ligonier] Add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/ligonier.py | 48 ++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 youtube_dl/extractor/ligonier.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 464c8d690..6dcb91c42 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -558,6 +558,7 @@ from .lego import LEGOIE from .lemonde import LemondeIE from .lenta import LentaIE from .libraryofcongress import LibraryOfCongressIE +from .ligonier import LigonierIE from .libsyn import LibsynIE from .lifenews import ( LifeNewsIE, diff --git a/youtube_dl/extractor/ligonier.py b/youtube_dl/extractor/ligonier.py new file mode 100644 index 000000000..c355a78f2 --- /dev/null +++ b/youtube_dl/extractor/ligonier.py @@ -0,0 +1,48 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class LigonierIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?ligonier\.org/learn/(?P.*)' + _TESTS = [ + { + 'url': 'https://www.ligonier.org/learn/daily-video/2018/10/01/a-permanent-birth/', + 'info_dict': { + 'id': 'a-permanent-birth', + 'description': "Ironically, we can become so afraid of losing something that we no longer fully enjoy having it. This is true in both everyday affairs and in spiritual matters. People will sometimes keep a prized possession out of harm's way to such an extent that they no longer use it or enjoy it. Fortunately, Christians can rejoice in the knowledge that the forgiveness of sins, their relationship with God, and their eternal hope can never be taken away. Few truths are as beautiful as God's promise that those who are born again receive a permanent birth and can never lose their status as His sons and daughters.", + 'ext': 'mp4', + 'title': 'A Permanent Birth by Steven Lawson | October 1, 2018', + 'thumbnail': r're:^https?://.*\.jpg$', + } + }, + { + 'url': 'https://www.ligonier.org/learn/series/learning-love-psalms/introduction-part-1-attractions-difficulties/?', + 'info_dict': { + 'id': 'introduction-part-1-attractions-difficulties', + 'description': "The Psalms have a Godward direction, being God’s words to us to give back to Him. In this lesson, Dr. Godfrey discusses the uniqueness of the Psalms as well as the difficulties that must be overcome if we are to learn to love them.", + 'ext': 'mp4', + 'title': 'Introduction (Part 1): Attractions & Difficulties by W. Robert Godfrey', + 'thumbnail': r're:^https?://.*\.jpg$', + } + } + ] + + def _real_extract(self, url): + video_id = self._getId(url) + webpage = self._download_webpage(url, video_id) + url = self._html_search_regex(r"{\"file\":\s?\"(?Phttps?:.[^\"]*)\"", webpage, 'url') + thumbnail = self._html_search_regex(r"\"image\":\s?\"(?Phttps?:.[^\"]*)\"", webpage, 'thumbnail') + return { + 'id': video_id, + 'url': url, + 'thumbnail': thumbnail, + 'title': self._og_search_title(webpage), + 'description': self._og_search_description(webpage), + 'format': 'mp4', + } + + def _getId(self, url): + matched_string = self._match_id(url) + return matched_string.rstrip('/?').split('/')[-1]