]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/malemotion.py
Update changelog.
[youtubedl] / youtube_dl / extractor / malemotion.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6 from ..utils import (
7 compat_urllib_parse,
8 )
9
10 class MalemotionIE(InfoExtractor):
11 _VALID_URL = r'^(?:https?://)?malemotion\.com/video/(.+?)\.(?P<id>.+?)(#|$)'
12 _TEST = {
13 'url': 'http://malemotion.com/video/bien-dur.10ew',
14 'file': '10ew.mp4',
15 'md5': 'b3cc49f953b107e4a363cdff07d100ce',
16 'info_dict': {
17 "title": "Bien dur",
18 "age_limit": 18,
19 },
20 'skip': 'This video has been deleted.'
21 }
22
23 def _real_extract(self, url):
24 mobj = re.match(self._VALID_URL, url)
25 video_id = mobj.group("id")
26
27 webpage = self._download_webpage(url, video_id)
28
29 self.report_extraction(video_id)
30
31 # Extract video URL
32 video_url = compat_urllib_parse.unquote(
33 self._search_regex(r'<source type="video/mp4" src="(.+?)"', webpage, 'video URL'))
34
35 # Extract title
36 video_title = self._html_search_regex(
37 r'<title>(.*?)</title', webpage, 'title')
38
39 # Extract video thumbnail
40 video_thumbnail = self._search_regex(
41 r'<video .+?poster="(.+?)"', webpage, 'thumbnail', fatal=False)
42
43 formats = [{
44 'url': video_url,
45 'ext': 'mp4',
46 'format_id': 'mp4',
47 'preference': 1,
48 }]
49
50 return {
51 'id': video_id,
52 'formats': formats,
53 'uploader': None,
54 'upload_date': None,
55 'title': video_title,
56 'thumbnail': video_thumbnail,
57 'description': None,
58 'age_limit': 18,
59 }