aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/libsyn.py
diff options
context:
space:
mode:
authorfelix <m.p.isaev@yandex.com>2015-03-16 20:05:02 +0100
committerfelix <m.p.isaev@yandex.com>2015-03-16 20:05:02 +0100
commit2e90dff2c2ecade8afb444b086fbc0ad6d2c812d (patch)
treebf358a6f52aa66767fc7b8ef5dc10e6b4dc1ad9b /youtube_dl/extractor/libsyn.py
parent90183a46d85758c59814187d9c777e4237a66afe (diff)
downloadyoutube-dl-2e90dff2c2ecade8afb444b086fbc0ad6d2c812d.tar.xz
The Daily Show Podcast support
Diffstat (limited to 'youtube_dl/extractor/libsyn.py')
-rw-r--r--youtube_dl/extractor/libsyn.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/youtube_dl/extractor/libsyn.py b/youtube_dl/extractor/libsyn.py
new file mode 100644
index 000000000..4b5029f89
--- /dev/null
+++ b/youtube_dl/extractor/libsyn.py
@@ -0,0 +1,41 @@
+# encoding: utf-8
+from .common import InfoExtractor
+from ..utils import (
+ unified_strdate,
+)
+
+class LibsynIE(InfoExtractor):
+ _VALID_URL = r'(?:https?:)?//html5-player\.libsyn\.com/embed/episode/id/(?P<id>[0-9]+)(?:/.*)?'
+
+ def _real_extract(self, url):
+ if url.startswith('//'):
+ url = 'https:' + url
+ display_id = self._match_id(url)
+ webpage = self._download_webpage(url, display_id)
+
+ podcast_title = self._search_regex(r'<h2>(.*?)</h2>', webpage, 'show title')
+ podcast_episode_title = self._search_regex(r'<h3>(.*?)</h3>', webpage, 'episode title')
+ podcast_date = unified_strdate(self._search_regex(r'<div class="release_date">Released: (.*?)</div>', webpage, 'release date'))
+ podcast_description = self._search_regex(r'<div id="info_text_body">(.*?)</div>', webpage, 'description')
+
+ url0 = self._search_regex(r'var mediaURLLibsyn = "(?P<url0>https?://.*)";', webpage, 'first media URL')
+ url1 = self._search_regex(r'var mediaURL = "(?P<url1>https?://.*)";', webpage, 'second media URL')
+
+ if url0 != url1:
+ formats = [{
+ 'url': url0
+ }, {
+ 'url': url1
+ }]
+ else:
+ formats = [{
+ 'url': url0
+ }]
+
+ return {
+ 'id': display_id,
+ 'title': podcast_episode_title,
+ 'description': podcast_description,
+ 'upload_date': podcast_date,
+ 'formats': formats,
+ }