| 
									
										
										
										
											2014-03-23 14:04:36 +01:00
										 |  |  | from __future__ import unicode_literals | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from .common import InfoExtractor | 
					
						
							| 
									
										
										
										
											2015-07-17 23:49:14 +06:00
										 |  |  | from ..compat import compat_urllib_parse_unquote | 
					
						
							| 
									
										
										
										
											2014-03-23 14:04:36 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class XBefIE(InfoExtractor): | 
					
						
							| 
									
										
										
										
											2016-03-21 21:36:32 +06:00
										 |  |  |     _VALID_URL = r'https?://(?:www\.)?xbef\.com/video/(?P<id>[0-9]+)' | 
					
						
							| 
									
										
										
										
											2014-03-23 14:04:36 +01:00
										 |  |  |     _TEST = { | 
					
						
							|  |  |  |         'url': 'http://xbef.com/video/5119-glamourous-lesbians-smoking-drinking-and-fucking', | 
					
						
							|  |  |  |         'md5': 'a478b565baff61634a98f5e5338be995', | 
					
						
							|  |  |  |         'info_dict': { | 
					
						
							|  |  |  |             'id': '5119', | 
					
						
							|  |  |  |             'ext': 'mp4', | 
					
						
							|  |  |  |             'title': 'md5:7358a9faef8b7b57acda7c04816f170e', | 
					
						
							|  |  |  |             'age_limit': 18, | 
					
						
							| 
									
										
										
										
											2017-01-02 20:08:07 +08:00
										 |  |  |             'thumbnail': r're:^http://.*\.jpg', | 
					
						
							| 
									
										
										
										
											2014-03-23 14:04:36 +01:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def _real_extract(self, url): | 
					
						
							| 
									
										
										
										
											2014-12-13 12:24:42 +01:00
										 |  |  |         video_id = self._match_id(url) | 
					
						
							| 
									
										
										
										
											2014-03-23 14:04:36 +01:00
										 |  |  |         webpage = self._download_webpage(url, video_id) | 
					
						
							| 
									
										
										
										
											2014-12-13 12:24:42 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-03-23 14:04:36 +01:00
										 |  |  |         title = self._html_search_regex( | 
					
						
							|  |  |  |             r'<h1[^>]*>(.*?)</h1>', webpage, 'title') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         config_url_enc = self._download_webpage( | 
					
						
							|  |  |  |             'http://xbef.com/Main/GetVideoURLEncoded/%s' % video_id, video_id, | 
					
						
							|  |  |  |             note='Retrieving config URL') | 
					
						
							| 
									
										
										
										
											2015-07-17 23:49:14 +06:00
										 |  |  |         config_url = compat_urllib_parse_unquote(config_url_enc) | 
					
						
							| 
									
										
										
										
											2014-03-23 14:04:36 +01:00
										 |  |  |         config = self._download_xml( | 
					
						
							|  |  |  |             config_url, video_id, note='Retrieving config') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         video_url = config.find('./file').text | 
					
						
							|  |  |  |         thumbnail = config.find('./image').text | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return { | 
					
						
							|  |  |  |             'id': video_id, | 
					
						
							|  |  |  |             'url': video_url, | 
					
						
							|  |  |  |             'title': title, | 
					
						
							|  |  |  |             'thumbnail': thumbnail, | 
					
						
							|  |  |  |             'age_limit': 18, | 
					
						
							|  |  |  |         } |