aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorEric Wong <eric@taedium.com>2015-06-15 01:07:48 -0700
committerSergey M․ <dstftw@gmail.com>2015-07-04 05:12:10 +0600
commit2a46a27e6c704f7b99242243747fa7d8ac68cefc (patch)
tree84d3c549d0300e004c599b3bdae467fb3cb4b18e /youtube_dl/extractor
parent0bcdc276530fe26725857eda5127aefc326ddc47 (diff)
[thisamericanlife] Add a new extractor
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/__init__.py1
-rw-r--r--youtube_dl/extractor/thisamericanlife.py32
2 files changed, 33 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py
index d44339200..aba62db53 100644
--- a/youtube_dl/extractor/__init__.py
+++ b/youtube_dl/extractor/__init__.py
@@ -569,6 +569,7 @@ from .tf1 import TF1IE
from .theonion import TheOnionIE
from .theplatform import ThePlatformIE
from .thesixtyone import TheSixtyOneIE
+from .thisamericanlife import ThisAmericanLifeIE
from .thisav import ThisAVIE
from .tinypic import TinyPicIE
from .tlc import TlcIE, TlcDeIE
diff --git a/youtube_dl/extractor/thisamericanlife.py b/youtube_dl/extractor/thisamericanlife.py
new file mode 100644
index 000000000..6118afa1a
--- /dev/null
+++ b/youtube_dl/extractor/thisamericanlife.py
@@ -0,0 +1,32 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+
+
+class ThisAmericanLifeIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?thisamericanlife\.org/radio-archives/episode/(?P<id>\d+)'
+ _TEST = {
+ 'url': 'http://www.thisamericanlife.org/radio-archives/episode/487/harper-high-school-part-one',
+ 'md5': '5cda28076c9f9d1fd0b0f5cff5959948',
+ 'info_dict': {
+ 'id': '487',
+ 'title': '487: Harper High School, Part One',
+ 'url' : 'http://stream.thisamericanlife.org/487/stream/487_64k.m3u8',
+ 'ext': 'aac',
+ }
+ }
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ webpage = self._download_webpage(url, video_id)
+
+ title = self._html_search_regex(r'<h1[^>]*>(.*?)</h1>', webpage, 'title')
+ media_url = 'http://stream.thisamericanlife.org/' + video_id + '/stream/' + video_id + '_64k.m3u8'
+
+ return {
+ 'id': video_id,
+ 'title': title,
+ 'url': media_url,
+ 'ext': 'aac',
+ }