| 
									
										
										
										
											2014-12-13 12:24:42 +01:00
										 |  |  | # coding: utf-8 | 
					
						
							| 
									
										
										
										
											2014-01-27 07:42:30 +01:00
										 |  |  | from __future__ import unicode_literals | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from .common import InfoExtractor | 
					
						
							| 
									
										
										
										
											2015-07-17 23:41:14 +06:00
										 |  |  | from ..compat import compat_urllib_parse_unquote | 
					
						
							| 
									
										
										
										
											2014-01-27 07:42:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-23 20:41:03 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-27 07:42:30 +01:00
										 |  |  | class MalemotionIE(InfoExtractor): | 
					
						
							| 
									
										
										
										
											2014-12-13 12:24:42 +01:00
										 |  |  |     _VALID_URL = r'https?://malemotion\.com/video/(.+?)\.(?P<id>.+?)(#|$)' | 
					
						
							| 
									
										
										
										
											2014-01-27 07:42:30 +01:00
										 |  |  |     _TEST = { | 
					
						
							| 
									
										
										
										
											2014-12-13 12:24:42 +01:00
										 |  |  |         'url': 'http://malemotion.com/video/bete-de-concours.ltc', | 
					
						
							|  |  |  |         'md5': '3013e53a0afbde2878bc39998c33e8a5', | 
					
						
							| 
									
										
										
										
											2014-01-27 07:42:30 +01:00
										 |  |  |         'info_dict': { | 
					
						
							| 
									
										
										
										
											2014-12-13 12:24:42 +01:00
										 |  |  |             'id': 'ltc', | 
					
						
							|  |  |  |             'ext': 'mp4', | 
					
						
							|  |  |  |             'title': 'Bête de Concours', | 
					
						
							|  |  |  |             'age_limit': 18, | 
					
						
							| 
									
										
										
										
											2014-01-30 06:15:46 +01:00
										 |  |  |         }, | 
					
						
							| 
									
										
										
										
											2014-01-27 07:42:30 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def _real_extract(self, url): | 
					
						
							| 
									
										
										
										
											2014-12-13 12:24:42 +01:00
										 |  |  |         video_id = self._match_id(url) | 
					
						
							| 
									
										
										
										
											2014-01-27 07:42:30 +01:00
										 |  |  |         webpage = self._download_webpage(url, video_id) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-17 23:41:14 +06:00
										 |  |  |         video_url = compat_urllib_parse_unquote(self._search_regex( | 
					
						
							| 
									
										
										
										
											2014-12-13 12:24:42 +01:00
										 |  |  |             r'<source type="video/mp4" src="(.+?)"', webpage, 'video URL')) | 
					
						
							| 
									
										
										
										
											2014-01-27 07:42:30 +01:00
										 |  |  |         video_title = self._html_search_regex( | 
					
						
							|  |  |  |             r'<title>(.*?)</title', webpage, 'title') | 
					
						
							|  |  |  |         video_thumbnail = self._search_regex( | 
					
						
							|  |  |  |             r'<video .+?poster="(.+?)"', webpage, 'thumbnail', fatal=False) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         formats = [{ | 
					
						
							|  |  |  |             'url': video_url, | 
					
						
							|  |  |  |             'ext': 'mp4', | 
					
						
							|  |  |  |             'format_id': 'mp4', | 
					
						
							|  |  |  |             'preference': 1, | 
					
						
							|  |  |  |         }] | 
					
						
							| 
									
										
										
										
											2014-12-13 12:24:42 +01:00
										 |  |  |         self._sort_formats(formats) | 
					
						
							| 
									
										
										
										
											2014-01-27 07:42:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |         return { | 
					
						
							|  |  |  |             'id': video_id, | 
					
						
							|  |  |  |             'formats': formats, | 
					
						
							|  |  |  |             'title': video_title, | 
					
						
							|  |  |  |             'thumbnail': video_thumbnail, | 
					
						
							|  |  |  |             'age_limit': 18, | 
					
						
							|  |  |  |         } |