aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2014-02-11 14:38:17 +0100
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2014-02-11 14:38:17 +0100
commit0ae6b019376313bd3dc9fbd4e2784c1aa909e75b (patch)
treeb3dee709a2ae4b6771c54d1bd324c11dc232fe06 /youtube_dl/extractor
parentdef630e523a31145986f0d651d3dde54e52bff30 (diff)
[cnn] Add an extractor for blogs (closes #2361)
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/__init__.py5
-rw-r--r--youtube_dl/extractor/cnn.py26
2 files changed, 30 insertions, 1 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py
index 700e9920e..cee825cb5 100644
--- a/youtube_dl/extractor/__init__.py
+++ b/youtube_dl/extractor/__init__.py
@@ -32,7 +32,10 @@ from .clipfish import ClipfishIE
from .cliphunter import CliphunterIE
from .clipsyndicate import ClipsyndicateIE
from .cmt import CMTIE
-from .cnn import CNNIE
+from .cnn import (
+ CNNIE,
+ CNNBlogsIE,
+)
from .collegehumor import CollegeHumorIE
from .comedycentral import ComedyCentralIE, ComedyCentralShowsIE
from .condenast import CondeNastIE
diff --git a/youtube_dl/extractor/cnn.py b/youtube_dl/extractor/cnn.py
index 80bf59ade..b32cb8980 100644
--- a/youtube_dl/extractor/cnn.py
+++ b/youtube_dl/extractor/cnn.py
@@ -6,6 +6,7 @@ from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_duration,
+ url_basename,
)
@@ -98,3 +99,28 @@ class CNNIE(InfoExtractor):
'duration': duration,
'upload_date': upload_date,
}
+
+
+class CNNBlogsIE(InfoExtractor):
+ _VALID_URL = r'https?://[^\.]+\.blogs\.cnn\.com/.+'
+ _TEST = {
+ 'url': 'http://reliablesources.blogs.cnn.com/2014/02/09/criminalizing-journalism/',
+ 'md5': '3e56f97b0b6ffb4b79f4ea0749551084',
+ 'info_dict': {
+ 'id': 'bestoftv/2014/02/09/criminalizing-journalism.cnn',
+ 'ext': 'mp4',
+ 'title': 'Criminalizing journalism?',
+ 'description': 'Glenn Greenwald responds to comments made this week on Capitol Hill that journalists could be criminal accessories.',
+ 'upload_date': '20140209',
+ },
+ 'add_ie': ['CNN'],
+ }
+
+ def _real_extract(self, url):
+ webpage = self._download_webpage(url, url_basename(url))
+ cnn_url = self._html_search_regex(r'data-url="(.+?)"', webpage, 'cnn url')
+ return {
+ '_type': 'url',
+ 'url': cnn_url,
+ 'ie_key': CNNIE.ie_key(),
+ }