| 
									
										
										
										
											2014-09-13 07:07:39 +02:00
										 |  |  | from __future__ import unicode_literals | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import re | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-01 15:34:46 +02:00
										 |  |  | from .jwplatform import JWPlatformBaseIE | 
					
						
							| 
									
										
										
										
											2014-09-13 07:07:39 +02:00
										 |  |  | from ..utils import ( | 
					
						
							|  |  |  |     str_to_int, | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-13 07:09:39 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-01 15:34:46 +02:00
										 |  |  | class PornoXOIE(JWPlatformBaseIE): | 
					
						
							| 
									
										
										
										
											2014-09-13 07:07:39 +02:00
										 |  |  |     _VALID_URL = r'https?://(?:www\.)?pornoxo\.com/videos/(?P<id>\d+)/(?P<display_id>[^/]+)\.html' | 
					
						
							|  |  |  |     _TEST = { | 
					
						
							|  |  |  |         'url': 'http://www.pornoxo.com/videos/7564/striptease-from-sexy-secretary.html', | 
					
						
							|  |  |  |         'md5': '582f28ecbaa9e6e24cb90f50f524ce87', | 
					
						
							|  |  |  |         'info_dict': { | 
					
						
							|  |  |  |             'id': '7564', | 
					
						
							|  |  |  |             'ext': 'flv', | 
					
						
							|  |  |  |             'title': 'Striptease From Sexy Secretary!', | 
					
						
							| 
									
										
										
										
											2016-10-01 15:34:46 +02:00
										 |  |  |             'display_id': 'striptease-from-sexy-secretary', | 
					
						
							|  |  |  |             'description': 'md5:0ee35252b685b3883f4a1d38332f9980', | 
					
						
							| 
									
										
										
										
											2014-09-13 07:07:39 +02:00
										 |  |  |             'categories': list,  # NSFW | 
					
						
							| 
									
										
										
										
											2017-01-02 20:08:07 +08:00
										 |  |  |             'thumbnail': r're:https?://.*\.jpg$', | 
					
						
							| 
									
										
										
										
											2014-09-13 07:07:39 +02:00
										 |  |  |             'age_limit': 18, | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def _real_extract(self, url): | 
					
						
							|  |  |  |         mobj = re.match(self._VALID_URL, url) | 
					
						
							| 
									
										
										
										
											2016-10-01 15:34:46 +02:00
										 |  |  |         video_id, display_id = mobj.groups() | 
					
						
							| 
									
										
										
										
											2014-09-13 07:07:39 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         webpage = self._download_webpage(url, video_id) | 
					
						
							| 
									
										
										
										
											2016-10-01 15:34:46 +02:00
										 |  |  |         video_data = self._extract_jwplayer_data(webpage, video_id, require_title=False) | 
					
						
							| 
									
										
										
										
											2014-09-13 07:07:39 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         title = self._html_search_regex( | 
					
						
							|  |  |  |             r'<title>([^<]+)\s*-\s*PornoXO', webpage, 'title') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         view_count = str_to_int(self._html_search_regex( | 
					
						
							| 
									
										
										
										
											2014-09-13 07:09:39 +02:00
										 |  |  |             r'[vV]iews:\s*([0-9,]+)', webpage, 'view count', fatal=False)) | 
					
						
							| 
									
										
										
										
											2014-09-13 07:07:39 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         categories_str = self._html_search_regex( | 
					
						
							|  |  |  |             r'<meta name="description" content=".*featuring\s*([^"]+)"', | 
					
						
							|  |  |  |             webpage, 'categories', fatal=False) | 
					
						
							|  |  |  |         categories = ( | 
					
						
							|  |  |  |             None if categories_str is None | 
					
						
							|  |  |  |             else categories_str.split(',')) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-01 15:34:46 +02:00
										 |  |  |         video_data.update({ | 
					
						
							| 
									
										
										
										
											2014-09-13 07:07:39 +02:00
										 |  |  |             'id': video_id, | 
					
						
							|  |  |  |             'title': title, | 
					
						
							| 
									
										
										
										
											2016-10-01 15:34:46 +02:00
										 |  |  |             'display_id': display_id, | 
					
						
							|  |  |  |             'description': self._html_search_meta('description', webpage), | 
					
						
							| 
									
										
										
										
											2014-09-13 07:07:39 +02:00
										 |  |  |             'categories': categories, | 
					
						
							|  |  |  |             'view_count': view_count, | 
					
						
							|  |  |  |             'age_limit': 18, | 
					
						
							| 
									
										
										
										
											2016-10-01 15:34:46 +02:00
										 |  |  |         }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return video_data |