]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/malemotion.py
Merge remote-tracking branch 'lenaten/8tracks'
[yt-dlp.git] / youtube_dl / extractor / malemotion.py
CommitLineData
1cc79574 1# coding: utf-8
4d9be98d
M
2from __future__ import unicode_literals
3
4d9be98d 4from .common import InfoExtractor
1cc79574 5from ..compat import (
4d9be98d
M
6 compat_urllib_parse,
7)
8
5f6a1245 9
4d9be98d 10class MalemotionIE(InfoExtractor):
1cc79574 11 _VALID_URL = r'https?://malemotion\.com/video/(.+?)\.(?P<id>.+?)(#|$)'
4d9be98d 12 _TEST = {
1cc79574
PH
13 'url': 'http://malemotion.com/video/bete-de-concours.ltc',
14 'md5': '3013e53a0afbde2878bc39998c33e8a5',
4d9be98d 15 'info_dict': {
1cc79574
PH
16 'id': 'ltc',
17 'ext': 'mp4',
18 'title': 'BĂȘte de Concours',
19 'age_limit': 18,
1a0648b4 20 },
4d9be98d
M
21 }
22
23 def _real_extract(self, url):
1cc79574 24 video_id = self._match_id(url)
4d9be98d
M
25 webpage = self._download_webpage(url, video_id)
26
1cc79574
PH
27 video_url = compat_urllib_parse.unquote(self._search_regex(
28 r'<source type="video/mp4" src="(.+?)"', webpage, 'video URL'))
4d9be98d
M
29 video_title = self._html_search_regex(
30 r'<title>(.*?)</title', webpage, 'title')
4d9be98d
M
31 video_thumbnail = self._search_regex(
32 r'<video .+?poster="(.+?)"', webpage, 'thumbnail', fatal=False)
33
34 formats = [{
35 'url': video_url,
36 'ext': 'mp4',
37 'format_id': 'mp4',
38 'preference': 1,
39 }]
1cc79574 40 self._sort_formats(formats)
4d9be98d
M
41
42 return {
43 'id': video_id,
44 'formats': formats,
4d9be98d
M
45 'title': video_title,
46 'thumbnail': video_thumbnail,
4d9be98d
M
47 'age_limit': 18,
48 }