| 
									
										
										
										
											2014-09-21 15:13:35 +03:00
										 |  |  | # coding: utf-8 | 
					
						
							|  |  |  | from __future__ import unicode_literals | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from .common import InfoExtractor | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class YourUploadIE(InfoExtractor): | 
					
						
							|  |  |  |     _VALID_URL = r'''(?x)https?://(?:www\.)?
 | 
					
						
							|  |  |  |         (?:yourupload\.com/watch| | 
					
						
							|  |  |  |            embed\.yourupload\.com| | 
					
						
							|  |  |  |            embed\.yucache\.net | 
					
						
							|  |  |  |         )/(?P<id>[A-Za-z0-9]+) | 
					
						
							|  |  |  |         '''
 | 
					
						
							|  |  |  |     _TESTS = [ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             'url': 'http://yourupload.com/watch/14i14h', | 
					
						
							| 
									
										
										
										
											2015-04-29 04:03:07 +08:00
										 |  |  |             'md5': '5e2c63385454c557f97c4c4131a393cd', | 
					
						
							| 
									
										
										
										
											2014-09-21 15:13:35 +03:00
										 |  |  |             'info_dict': { | 
					
						
							|  |  |  |                 'id': '14i14h', | 
					
						
							|  |  |  |                 'ext': 'mp4', | 
					
						
							|  |  |  |                 'title': 'BigBuckBunny_320x180.mp4', | 
					
						
							|  |  |  |                 'thumbnail': 're:^https?://.*\.jpe?g', | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             'url': 'http://embed.yourupload.com/14i14h', | 
					
						
							|  |  |  |             'only_matching': True, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             'url': 'http://embed.yucache.net/14i14h?client_file_id=803349', | 
					
						
							|  |  |  |             'only_matching': True, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     ] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def _real_extract(self, url): | 
					
						
							| 
									
										
										
										
											2015-04-29 04:05:14 +08:00
										 |  |  |         video_id = self._match_id(url) | 
					
						
							| 
									
										
										
										
											2014-09-21 15:13:35 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-29 04:03:07 +08:00
										 |  |  |         embed_url = 'http://embed.yucache.net/{0:}'.format(video_id) | 
					
						
							|  |  |  |         webpage = self._download_webpage(embed_url, video_id) | 
					
						
							| 
									
										
										
										
											2014-09-21 15:13:35 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |         title = self._og_search_title(webpage) | 
					
						
							| 
									
										
										
										
											2015-04-29 04:03:07 +08:00
										 |  |  |         video_url = self._og_search_video_url(webpage) | 
					
						
							| 
									
										
										
										
											2015-04-29 04:05:14 +08:00
										 |  |  |         thumbnail = self._og_search_thumbnail(webpage, default=None) | 
					
						
							| 
									
										
										
										
											2014-09-21 15:13:35 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |         return { | 
					
						
							|  |  |  |             'id': video_id, | 
					
						
							|  |  |  |             'title': title, | 
					
						
							| 
									
										
										
										
											2015-04-29 04:05:14 +08:00
										 |  |  |             'url': video_url, | 
					
						
							| 
									
										
										
										
											2014-09-21 15:13:35 +03:00
										 |  |  |             'thumbnail': thumbnail, | 
					
						
							| 
									
										
										
										
											2015-04-29 04:03:07 +08:00
										 |  |  |             'http_headers': { | 
					
						
							|  |  |  |                 'Referer': embed_url, | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2014-09-21 15:13:35 +03:00
										 |  |  |         } |