diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-11-12 15:34:31 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-11-12 15:34:31 +0100 |
commit | 0b201a3134e9b343e2791f2686f1a34f737007a4 (patch) | |
tree | 73f1be507993be7f4cfd7a621379f510d9a1e2fc /youtube_dl/extractor | |
parent | ffe38646cafe890aafa1f6627d14945adc8cf0b3 (diff) | |
parent | b868c972d1c1bc7978e4afee51da3322abb6cc6d (diff) |
Merge remote-tracking branch 'xantares/goldenmoustache'
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/__init__.py | 1 | ||||
-rw-r--r-- | youtube_dl/extractor/goldenmoustache.py | 50 |
2 files changed, 51 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 3c1807f15..21853ccf4 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -141,6 +141,7 @@ from .generic import GenericIE from .glide import GlideIE from .globo import GloboIE from .godtube import GodTubeIE +from .goldenmoustache import GoldenMoustacheIE from .golem import GolemIE from .googleplus import GooglePlusIE from .googlesearch import GoogleSearchIE diff --git a/youtube_dl/extractor/goldenmoustache.py b/youtube_dl/extractor/goldenmoustache.py new file mode 100644 index 000000000..c25d2e779 --- /dev/null +++ b/youtube_dl/extractor/goldenmoustache.py @@ -0,0 +1,50 @@ +from __future__ import unicode_literals + +import re +from .common import InfoExtractor +from ..utils import ( + parse_duration, + int_or_none, +) + + +class GoldenMoustacheIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?goldenmoustache\.com/(?P<display_id>[\w-]+)-(?P<id>\d+)' + _TEST = { + 'url': 'http://www.goldenmoustache.com/suricate-le-poker-3700/', + 'md5': '0f904432fa07da5054d6c8beb5efb51a', + 'info_dict': { + 'id': '3700', + 'ext': 'mp4', + 'title': 'Suricate - Le Poker', + 'description': 'md5:3d1f242f44f8c8cb0a106f1fd08e5dc9', + 'thumbnail': 'md5:fd41386bc1f932552622da4a7e9a7242', + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + + webpage = self._download_webpage(url, video_id) + + video_url = self._html_search_regex(r'data-src-type="mp4" data-src="([^"]+)"', webpage, 'video URL') + + title = self._html_search_regex(r'<title>(.*?) - Golden Moustache</title>', webpage, 'title') + + thumbnail = self._html_search_meta('og:image', webpage, 'thumbnail') + + description = self._html_search_meta('og:description', webpage, 'description') + + view_count = int_or_none(self._html_search_regex( + r'<strong>(\d+)</strong>\s*VUES</span>', webpage, 'view count', fatal=False)) + + return { + 'id': video_id, + 'url': video_url, + 'ext': 'mp4', + 'title': title, + 'description': description, + 'thumbnail': thumbnail, + 'view_count': view_count, + } |