summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-01-23 00:12:47 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-01-23 00:12:47 +0100
commit066f6a06305c715c94054ea00734e9259d5a2257 (patch)
tree93c4a25b94aaf471d686d35ff96b828048085bf5
parent12ed57418c9c46b483ccd326a13724d91c2b911d (diff)
downloadyoutube-dl-066f6a06305c715c94054ea00734e9259d5a2257.tar.gz
youtube-dl-066f6a06305c715c94054ea00734e9259d5a2257.tar.xz
youtube-dl-066f6a06305c715c94054ea00734e9259d5a2257.zip
[nowness] Add support
-rw-r--r--youtube_dl/extractor/__init__.py1
-rw-r--r--youtube_dl/extractor/brightcove.py2
-rw-r--r--youtube_dl/extractor/nowness.py49
3 files changed, 51 insertions, 1 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py
index 4d6aeabdf..118982ff8 100644
--- a/youtube_dl/extractor/__init__.py
+++ b/youtube_dl/extractor/__init__.py
@@ -136,6 +136,7 @@ from .nhl import NHLIE, NHLVideocenterIE
 from .niconico import NiconicoIE
 from .ninegag import NineGagIE
 from .novamov import NovamovIE
+from .nowness import NownessIE
 from .nowvideo import NowVideoIE
 from .ooyala import OoyalaIE
 from .orf import ORFIE
diff --git a/youtube_dl/extractor/brightcove.py b/youtube_dl/extractor/brightcove.py
index e1c45d1f0..443294e6f 100644
--- a/youtube_dl/extractor/brightcove.py
+++ b/youtube_dl/extractor/brightcove.py
@@ -198,7 +198,7 @@ class BrightcoveIE(InfoExtractor):
     def _extract_video_info(self, video_info):
         info = {
             'id': compat_str(video_info['id']),
-            'title': video_info['displayName'],
+            'title': video_info['displayName'].strip(),
             'description': video_info.get('shortDescription'),
             'thumbnail': video_info.get('videoStillURL') or video_info.get('thumbnailURL'),
             'uploader': video_info.get('publisherName'),
diff --git a/youtube_dl/extractor/nowness.py b/youtube_dl/extractor/nowness.py
new file mode 100644
index 000000000..b1bcb7e54
--- /dev/null
+++ b/youtube_dl/extractor/nowness.py
@@ -0,0 +1,49 @@
+from __future__ import unicode_literals
+
+import re
+
+from .brightcove import BrightcoveIE
+from .common import InfoExtractor
+from ..utils import (
+    ExtractorError,
+)
+
+
+class NownessIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:www\.)?nowness\.com/[^?#]*?/(?P<id>[0-9]+)/(?P<slug>[^/]+?)(?:$|[?#])'
+
+    _TEST = {
+        'url': 'http://www.nowness.com/day/2013/6/27/3131/candor--the-art-of-gesticulation',
+        'file': '2520295746001.mp4',
+        'md5': '0ece2f70a7bd252c7b00f3070182d418',
+        'info_dict': {
+            'description': 'Candor: The Art of Gesticulation',
+            'uploader': 'Nowness',
+            'title': 'Candor: The Art of Gesticulation',
+        }
+    }
+
+    def _real_extract(self, url):
+        mobj = re.match(self._VALID_URL, url)
+        video_id = mobj.group('slug')
+
+        webpage = self._download_webpage(url, video_id)
+        player_url = self._search_regex(
+            r'"([^"]+/content/issue-[0-9.]+.js)"', webpage, 'player URL')
+        real_id = self._search_regex(
+            r'\sdata-videoId="([0-9]+)"', webpage, 'internal video ID')
+
+        player_code = self._download_webpage(
+            player_url, video_id,
+            note='Downloading player JavaScript',
+            errnote='Player download failed')
+        player_code = player_code.replace("'+d+'", real_id)
+
+        bc_url = BrightcoveIE._extract_brightcove_url(player_code)
+        if bc_url is None:
+            raise ExtractorError('Could not find player definition')
+        return {
+            '_type': 'url',
+            'url': bc_url,
+            'ie_key': 'Brightcove',
+        }