diff options
author | Philipp Hagemeister <[email protected]> | 2014-04-04 00:25:35 +0200 |
---|---|---|
committer | Philipp Hagemeister <[email protected]> | 2014-04-04 00:25:35 +0200 |
commit | 2ad4d1ba077893e4020532f748547296801704e3 (patch) | |
tree | d22bafa720a43096732526ed09471946baa1ca54 /youtube_dl | |
parent | 4853de808ba1fcd77fc42e575b26cf3d13dd52a6 (diff) | |
download | youtube-dl-2ad4d1ba077893e4020532f748547296801704e3.tar.gz youtube-dl-2ad4d1ba077893e4020532f748547296801704e3.zip |
[morningstar] Add new extractor (Fixes #2687)
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/__init__.py | 1 | ||||
-rw-r--r-- | youtube_dl/extractor/morningstar.py | 55 |
2 files changed, 56 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 12c10d962..66f71edf6 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -154,6 +154,7 @@ from .mixcloud import MixcloudIE from .mpora import MporaIE from .mofosex import MofosexIE from .mooshare import MooshareIE +from .morningstar import MorningstarIE from .motorsport import MotorsportIE from .mtv import ( MTVIE, diff --git a/youtube_dl/extractor/morningstar.py b/youtube_dl/extractor/morningstar.py new file mode 100644 index 000000000..3d3225699 --- /dev/null +++ b/youtube_dl/extractor/morningstar.py @@ -0,0 +1,55 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import hashlib +import json +import re +import time + +from .common import InfoExtractor +from ..utils import ( + compat_parse_qs, + compat_str, + int_or_none, +) + + +class MorningstarIE(InfoExtractor): + IE_DESC = 'morningstar.com' + _VALID_URL = r'https?://(?:www\.)?morningstar\.com/cover/videocenter\.aspx\?id=(?P<id>[0-9]+)' + _TEST = { + 'url': 'http://www.morningstar.com/cover/videocenter.aspx?id=615869', + 'md5': '6c0acface7a787aadc8391e4bbf7b0f5', + 'info_dict': { + 'id': '615869', + 'ext': 'mp4', + 'title': 'Get Ahead of the Curve on 2013 Taxes', + 'description': "Vanguard's Joel Dickson on managing higher tax rates for high-income earners and fund capital-gain distributions in 2013.", + 'thumbnail': r're:^https?://.*m(?:orning)?star\.com/.+thumb\.jpg$' + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + + webpage = self._download_webpage(url, video_id) + title = self._html_search_regex( + r'<h1 id="titleLink">(.*?)</h1>', webpage, 'title') + video_url = self._html_search_regex( + r'<input type="hidden" id="hidVideoUrl" value="([^"]+)"', + webpage, 'video URL') + thumbnail = self._html_search_regex( + r'<input type="hidden" id="hidSnapshot" value="([^"]+)"', + webpage, 'thumbnail', fatal=False) + description = self._html_search_regex( + r'<div id="mstarDeck".*?>(.*?)</div>', + webpage, 'description', fatal=False) + + return { + 'id': video_id, + 'title': title, + 'url': video_url, + 'thumbnail': thumbnail, + 'description': description, + } |