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