| 
									
										
										
										
											2014-12-13 21:58:52 +01:00
										 |  |  | # coding: utf-8 | 
					
						
							|  |  |  | from __future__ import unicode_literals | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from .common import InfoExtractor | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class RestudyIE(InfoExtractor): | 
					
						
							| 
									
										
										
										
											2018-01-20 23:25:06 +07:00
										 |  |  |     _VALID_URL = r'https?://(?:(?:www|portal)\.)?restudy\.dk/video/[^/]+/id/(?P<id>[0-9]+)' | 
					
						
							|  |  |  |     _TESTS = [{ | 
					
						
							| 
									
										
										
										
											2014-12-13 21:58:52 +01:00
										 |  |  |         'url': 'https://www.restudy.dk/video/play/id/1637', | 
					
						
							|  |  |  |         'info_dict': { | 
					
						
							|  |  |  |             'id': '1637', | 
					
						
							| 
									
										
										
										
											2014-12-14 03:41:00 +06:00
										 |  |  |             'ext': 'flv', | 
					
						
							| 
									
										
										
										
											2014-12-13 21:58:52 +01:00
										 |  |  |             'title': 'Leiden-frosteffekt', | 
					
						
							| 
									
										
										
										
											2014-12-14 03:41:00 +06:00
										 |  |  |             'description': 'Denne video er et eksperiment med flydende kvælstof.', | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         'params': { | 
					
						
							|  |  |  |             # rtmp download | 
					
						
							|  |  |  |             'skip_download': True, | 
					
						
							| 
									
										
										
										
											2014-12-13 21:58:52 +01:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2018-01-20 23:25:06 +07:00
										 |  |  |     }, { | 
					
						
							|  |  |  |         'url': 'https://portal.restudy.dk/video/leiden-frosteffekt/id/1637', | 
					
						
							|  |  |  |         'only_matching': True, | 
					
						
							|  |  |  |     }] | 
					
						
							| 
									
										
										
										
											2014-12-13 21:58:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def _real_extract(self, url): | 
					
						
							|  |  |  |         video_id = self._match_id(url) | 
					
						
							| 
									
										
										
										
											2014-12-14 03:41:00 +06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-13 21:58:52 +01:00
										 |  |  |         webpage = self._download_webpage(url, video_id) | 
					
						
							| 
									
										
										
										
											2014-12-14 03:41:00 +06:00
										 |  |  | 
 | 
					
						
							|  |  |  |         title = self._og_search_title(webpage).strip() | 
					
						
							|  |  |  |         description = self._og_search_description(webpage).strip() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         formats = self._extract_smil_formats( | 
					
						
							| 
									
										
										
										
											2018-01-20 23:19:02 +07:00
										 |  |  |             'https://cdn.portal.restudy.dk/dynamic/themes/front/awsmedia/SmilDirectory/video_%s.xml' % video_id, | 
					
						
							| 
									
										
										
										
											2014-12-14 03:41:00 +06:00
										 |  |  |             video_id) | 
					
						
							| 
									
										
										
										
											2016-03-27 07:03:08 +06:00
										 |  |  |         self._sort_formats(formats) | 
					
						
							| 
									
										
										
										
											2014-12-14 03:41:00 +06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-13 21:58:52 +01:00
										 |  |  |         return { | 
					
						
							|  |  |  |             'id': video_id, | 
					
						
							|  |  |  |             'title': title, | 
					
						
							| 
									
										
										
										
											2014-12-14 03:41:00 +06:00
										 |  |  |             'description': description, | 
					
						
							|  |  |  |             'formats': formats, | 
					
						
							| 
									
										
										
										
											2014-12-13 21:58:52 +01:00
										 |  |  |         } |