diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2015-02-16 04:09:10 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2015-02-16 04:09:10 +0100 |
commit | 5bfd430f81c885decfb3dc7b5ad8478eefbaaaf7 (patch) | |
tree | fc07260fb86a1f1d844718d48203a5bf9f323f2d /youtube_dl/extractor/history.py | |
parent | 73fac4e9119bc53d49e646c38529f1b6d8de734d (diff) | |
parent | 8fb474fb17a64ff2aa9f6315ebbc99ae7938c4e1 (diff) |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'youtube_dl/extractor/history.py')
-rw-r--r-- | youtube_dl/extractor/history.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/youtube_dl/extractor/history.py b/youtube_dl/extractor/history.py new file mode 100644 index 000000000..f86164afe --- /dev/null +++ b/youtube_dl/extractor/history.py @@ -0,0 +1,31 @@ +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import smuggle_url + + +class HistoryIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?history\.com/(?:[^/]+/)+(?P<id>[^/]+?)(?:$|[?#])' + + _TESTS = [{ + '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', + 'md5': '6fe632d033c92aa10b8d4a9be047a7c5', + 'info_dict': { + 'id': 'bLx5Dv5Aka1G', + 'ext': 'mp4', + 'title': "Bet You Didn't Know: Valentine's Day", + 'description': 'md5:7b57ea4829b391995b405fa60bd7b5f7', + }, + 'add_ie': ['ThePlatform'], + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + + webpage = self._download_webpage(url, video_id) + + video_url = self._search_regex( + r'data-href="[^"]*/%s"[^>]+data-release-url="([^"]+)"' % video_id, + webpage, 'video url') + + return self.url_result(smuggle_url(video_url, {'sig': {'key': 'crazyjava', 'secret': 's3cr3t'}})) |