]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/history.py
[dailymotion] Error spelling
[youtube-dl] / youtube_dl / extractor / history.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..utils import smuggle_url
5
6
7 class HistoryIE(InfoExtractor):
8     _VALID_URL = r'https?://(?:www\.)?history\.com/(?:[^/]+/)+(?P<id>[^/]+?)(?:$|[?#])'
9
10     _TESTS = [{
11         'url': 'http://www.history.com/topics/valentines-day/history-of-valentines-day/videos/bet-you-didnt-know-valentines-day?m=528e394da93ae&s=undefined&f=1&free=false',
12         'md5': '6fe632d033c92aa10b8d4a9be047a7c5',
13         'info_dict': {
14             'id': 'bLx5Dv5Aka1G',
15             'ext': 'mp4',
16             'title': "Bet You Didn't Know: Valentine's Day",
17             'description': 'md5:7b57ea4829b391995b405fa60bd7b5f7',
18         },
19         'add_ie': ['ThePlatform'],
20     }]
21
22     def _real_extract(self, url):
23         video_id = self._match_id(url)
24
25         webpage = self._download_webpage(url, video_id)
26
27         video_url = self._search_regex(
28             r'data-href="[^"]*/%s"[^>]+data-release-url="([^"]+)"' % video_id,
29             webpage, 'video url')
30
31         return self.url_result(smuggle_url(video_url, {'sig': {'key': 'crazyjava', 'secret': 's3cr3t'}}))