| 
									
										
										
										
											2015-03-12 21:56:56 +06:00
										 |  |  |  | # coding: utf-8 | 
					
						
							|  |  |  |  | from __future__ import unicode_literals | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | from .common import InfoExtractor | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | class FootyRoomIE(InfoExtractor): | 
					
						
							| 
									
										
										
										
											2016-03-21 21:36:32 +06:00
										 |  |  |  |     _VALID_URL = r'https?://footyroom\.com/(?P<id>[^/]+)' | 
					
						
							| 
									
										
										
										
											2015-04-12 11:23:01 +02:00
										 |  |  |  |     _TESTS = [{ | 
					
						
							| 
									
										
										
										
											2015-03-12 21:56:56 +06:00
										 |  |  |  |         'url': 'http://footyroom.com/schalke-04-0-2-real-madrid-2015-02/', | 
					
						
							|  |  |  |  |         'info_dict': { | 
					
						
							|  |  |  |  |             'id': 'schalke-04-0-2-real-madrid-2015-02', | 
					
						
							|  |  |  |  |             'title': 'Schalke 04 0 – 2 Real Madrid', | 
					
						
							|  |  |  |  |         }, | 
					
						
							|  |  |  |  |         'playlist_count': 3, | 
					
						
							| 
									
										
										
										
											2015-12-13 23:55:10 +06:00
										 |  |  |  |         'skip': 'Video for this match is not available', | 
					
						
							| 
									
										
										
										
											2015-04-12 17:11:11 +06:00
										 |  |  |  |     }, { | 
					
						
							| 
									
										
										
										
											2015-04-12 11:23:01 +02:00
										 |  |  |  |         'url': 'http://footyroom.com/georgia-0-2-germany-2015-03/', | 
					
						
							|  |  |  |  |         'info_dict': { | 
					
						
							|  |  |  |  |             'id': 'georgia-0-2-germany-2015-03', | 
					
						
							|  |  |  |  |             'title': 'Georgia 0 – 2 Germany', | 
					
						
							|  |  |  |  |         }, | 
					
						
							|  |  |  |  |         'playlist_count': 1, | 
					
						
							| 
									
										
										
										
											2015-04-12 17:11:11 +06:00
										 |  |  |  |     }] | 
					
						
							| 
									
										
										
										
											2015-03-12 21:56:56 +06:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     def _real_extract(self, url): | 
					
						
							|  |  |  |  |         playlist_id = self._match_id(url) | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         webpage = self._download_webpage(url, playlist_id) | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         playlist = self._parse_json( | 
					
						
							|  |  |  |  |             self._search_regex( | 
					
						
							|  |  |  |  |                 r'VideoSelector\.load\((\[.+?\])\);', webpage, 'video selector'), | 
					
						
							|  |  |  |  |             playlist_id) | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         playlist_title = self._og_search_title(webpage) | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         entries = [] | 
					
						
							|  |  |  |  |         for video in playlist: | 
					
						
							|  |  |  |  |             payload = video.get('payload') | 
					
						
							|  |  |  |  |             if not payload: | 
					
						
							|  |  |  |  |                 continue | 
					
						
							|  |  |  |  |             playwire_url = self._search_regex( | 
					
						
							|  |  |  |  |                 r'data-config="([^"]+)"', payload, | 
					
						
							|  |  |  |  |                 'playwire url', default=None) | 
					
						
							|  |  |  |  |             if playwire_url: | 
					
						
							| 
									
										
										
										
											2015-04-12 17:09:52 +06:00
										 |  |  |  |                 entries.append(self.url_result(self._proto_relative_url( | 
					
						
							|  |  |  |  |                     playwire_url, 'http:'), 'Playwire')) | 
					
						
							| 
									
										
										
										
											2015-03-12 21:56:56 +06:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         return self.playlist_result(entries, playlist_id, playlist_title) |