| 
									
										
										
										
											2014-07-09 18:21:46 +02:00
										 |  |  | # -*- coding: utf-8 -*- | 
					
						
							|  |  |  | from __future__ import unicode_literals | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from .common import InfoExtractor | 
					
						
							| 
									
										
										
										
											2015-11-21 22:18:17 +06:00
										 |  |  | from ..compat import compat_urllib_parse | 
					
						
							| 
									
										
										
										
											2015-11-30 03:58:39 +06:00
										 |  |  | from ..utils import ( | 
					
						
							|  |  |  |     ExtractorError, | 
					
						
							|  |  |  |     sanitized_Request, | 
					
						
							|  |  |  | ) | 
					
						
							| 
									
										
										
										
											2014-07-09 18:21:46 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class VodlockerIE(InfoExtractor): | 
					
						
							| 
									
										
										
										
											2015-11-30 03:58:39 +06:00
										 |  |  |     _VALID_URL = r'https?://(?:www\.)?vodlocker\.com/(?:embed-)?(?P<id>[0-9a-zA-Z]+)(?:\..*?)?' | 
					
						
							| 
									
										
										
										
											2014-07-09 18:21:46 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     _TESTS = [{ | 
					
						
							|  |  |  |         'url': 'http://vodlocker.com/e8wvyzz4sl42', | 
					
						
							|  |  |  |         'md5': 'ce0c2d18fa0735f1bd91b69b0e54aacf', | 
					
						
							|  |  |  |         'info_dict': { | 
					
						
							|  |  |  |             'id': 'e8wvyzz4sl42', | 
					
						
							|  |  |  |             'ext': 'mp4', | 
					
						
							|  |  |  |             'title': 'Germany vs Brazil', | 
					
						
							|  |  |  |             'thumbnail': 're:http://.*\.jpg', | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     }] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def _real_extract(self, url): | 
					
						
							| 
									
										
										
										
											2014-12-13 12:24:42 +01:00
										 |  |  |         video_id = self._match_id(url) | 
					
						
							| 
									
										
										
										
											2014-07-09 18:21:46 +02:00
										 |  |  |         webpage = self._download_webpage(url, video_id) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-30 03:58:39 +06:00
										 |  |  |         if any(p in webpage for p in ( | 
					
						
							|  |  |  |                 '>THIS FILE WAS DELETED<', | 
					
						
							|  |  |  |                 '>File Not Found<', | 
					
						
							|  |  |  |                 'The file you were looking for could not be found, sorry for any inconvenience.<')): | 
					
						
							|  |  |  |             raise ExtractorError('Video %s does not exist' % video_id, expected=True) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-14 22:36:30 +06:00
										 |  |  |         fields = self._hidden_inputs(webpage) | 
					
						
							| 
									
										
										
										
											2014-07-09 18:21:46 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         if fields['op'] == 'download1': | 
					
						
							| 
									
										
										
										
											2014-07-11 10:57:08 +02:00
										 |  |  |             self._sleep(3, video_id)  # they do detect when requests happen too fast! | 
					
						
							| 
									
										
										
										
											2014-07-09 18:21:46 +02:00
										 |  |  |             post = compat_urllib_parse.urlencode(fields) | 
					
						
							| 
									
										
										
										
											2015-11-21 22:18:17 +06:00
										 |  |  |             req = sanitized_Request(url, post) | 
					
						
							| 
									
										
										
										
											2014-07-09 18:21:46 +02:00
										 |  |  |             req.add_header('Content-type', 'application/x-www-form-urlencoded') | 
					
						
							| 
									
										
										
										
											2014-07-11 10:57:08 +02:00
										 |  |  |             webpage = self._download_webpage( | 
					
						
							|  |  |  |                 req, video_id, 'Downloading video page') | 
					
						
							| 
									
										
										
										
											2014-07-09 18:21:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-11 10:57:08 +02:00
										 |  |  |         title = self._search_regex( | 
					
						
							| 
									
										
										
										
											2014-08-23 14:39:45 +02:00
										 |  |  |             r'id="file_title".*?>\s*(.*?)\s*<(?:br|span)', webpage, 'title') | 
					
						
							| 
									
										
										
										
											2014-07-11 10:57:08 +02:00
										 |  |  |         thumbnail = self._search_regex( | 
					
						
							|  |  |  |             r'image:\s*"(http[^\"]+)",', webpage, 'thumbnail') | 
					
						
							|  |  |  |         url = self._search_regex( | 
					
						
							|  |  |  |             r'file:\s*"(http[^\"]+)",', webpage, 'file url') | 
					
						
							| 
									
										
										
										
											2014-07-09 18:21:46 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         formats = [{ | 
					
						
							|  |  |  |             'format_id': 'sd', | 
					
						
							|  |  |  |             'url': url, | 
					
						
							|  |  |  |         }] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return { | 
					
						
							|  |  |  |             'id': video_id, | 
					
						
							|  |  |  |             'title': title, | 
					
						
							|  |  |  |             'thumbnail': thumbnail, | 
					
						
							|  |  |  |             'formats': formats, | 
					
						
							|  |  |  |         } |