]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/morningstar.py
Prepare for release.
[youtubedl] / youtube_dl / extractor / morningstar.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 import re
5
6 from .common import InfoExtractor
7
8
9 class MorningstarIE(InfoExtractor):
10 IE_DESC = 'morningstar.com'
11 _VALID_URL = r'https?://(?:www\.)?morningstar\.com/[cC]over/video[cC]enter\.aspx\?id=(?P<id>[0-9]+)'
12 _TEST = {
13 'url': 'http://www.morningstar.com/cover/videocenter.aspx?id=615869',
14 'md5': '6c0acface7a787aadc8391e4bbf7b0f5',
15 'info_dict': {
16 'id': '615869',
17 'ext': 'mp4',
18 'title': 'Get Ahead of the Curve on 2013 Taxes',
19 'description': "Vanguard's Joel Dickson on managing higher tax rates for high-income earners and fund capital-gain distributions in 2013.",
20 'thumbnail': r're:^https?://.*m(?:orning)?star\.com/.+thumb\.jpg$'
21 }
22 }
23
24 def _real_extract(self, url):
25 mobj = re.match(self._VALID_URL, url)
26 video_id = mobj.group('id')
27
28 webpage = self._download_webpage(url, video_id)
29 title = self._html_search_regex(
30 r'<h1 id="titleLink">(.*?)</h1>', webpage, 'title')
31 video_url = self._html_search_regex(
32 r'<input type="hidden" id="hidVideoUrl" value="([^"]+)"',
33 webpage, 'video URL')
34 thumbnail = self._html_search_regex(
35 r'<input type="hidden" id="hidSnapshot" value="([^"]+)"',
36 webpage, 'thumbnail', fatal=False)
37 description = self._html_search_regex(
38 r'<div id="mstarDeck".*?>(.*?)</div>',
39 webpage, 'description', fatal=False)
40
41 return {
42 'id': video_id,
43 'title': title,
44 'url': video_url,
45 'thumbnail': thumbnail,
46 'description': description,
47 }