[dailymotion] add support embed with DM.player js call
This commit is contained in:
		
							parent
							
								
									c560680247
								
							
						
					
					
						commit
						5e3da0d42b
					
				
					 2 changed files with 26 additions and 3 deletions
				
			
		| 
						 | 
					@ -137,10 +137,16 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @staticmethod
 | 
					    @staticmethod
 | 
				
			||||||
    def _extract_urls(webpage):
 | 
					    def _extract_urls(webpage):
 | 
				
			||||||
 | 
					        urls = []
 | 
				
			||||||
        # Look for embedded Dailymotion player
 | 
					        # Look for embedded Dailymotion player
 | 
				
			||||||
        matches = re.findall(
 | 
					        # https://developer.dailymotion.com/player#player-parameters
 | 
				
			||||||
            r'<(?:(?:embed|iframe)[^>]+?src=|input[^>]+id=[\'"]dmcloudUrlEmissionSelect[\'"][^>]+value=)(["\'])(?P<url>(?:https?:)?//(?:www\.)?dailymotion\.com/(?:embed|swf)/video/.+?)\1', webpage)
 | 
					        for mobj in re.finditer(
 | 
				
			||||||
        return list(map(lambda m: unescapeHTML(m[1]), matches))
 | 
					                r'<(?:(?:embed|iframe)[^>]+?src=|input[^>]+id=[\'"]dmcloudUrlEmissionSelect[\'"][^>]+value=)(["\'])(?P<url>(?:https?:)?//(?:www\.)?dailymotion\.com/(?:embed|swf)/video/.+?)\1', webpage):
 | 
				
			||||||
 | 
					            urls.append(unescapeHTML(mobj.group('url')))
 | 
				
			||||||
 | 
					        for mobj in re.finditer(
 | 
				
			||||||
 | 
					                r'(?s)DM\.player\([^,]+,\s*{.*?video[\'"]?\s*:\s*["\']?(?P<id>[0-9a-zA-Z]+).+?}\s*\);', webpage):
 | 
				
			||||||
 | 
					            urls.append('https://www.dailymotion.com/embed/video/' + mobj.group('id'))
 | 
				
			||||||
 | 
					        return urls
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _real_extract(self, url):
 | 
					    def _real_extract(self, url):
 | 
				
			||||||
        video_id = self._match_id(url)
 | 
					        video_id = self._match_id(url)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2104,6 +2104,23 @@ class GenericIE(InfoExtractor):
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            'expected_warnings': ['Failed to download MPD manifest'],
 | 
					            'expected_warnings': ['Failed to download MPD manifest'],
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            # DailyMotion embed with DM.player
 | 
				
			||||||
 | 
					            'url': 'https://www.beinsports.com/us/copa-del-rey/video/the-locker-room-valencia-beat-barca-in-copa/1203804',
 | 
				
			||||||
 | 
					            'info_dict': {
 | 
				
			||||||
 | 
					                'id': 'k6aKkGHd9FJs4mtJN39',
 | 
				
			||||||
 | 
					                'ext': 'mp4',
 | 
				
			||||||
 | 
					                'title': 'The Locker Room: Valencia Beat Barca In Copa del Rey Final',
 | 
				
			||||||
 | 
					                'description': 'This video is private.',
 | 
				
			||||||
 | 
					                'uploader_id': 'x1jf30l',
 | 
				
			||||||
 | 
					                'uploader': 'beIN SPORTS USA',
 | 
				
			||||||
 | 
					                'upload_date': '20190528',
 | 
				
			||||||
 | 
					                'timestamp': 1559062971,
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            'params': {
 | 
				
			||||||
 | 
					                'skip_download': True,
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        # {
 | 
					        # {
 | 
				
			||||||
        #     # TODO: find another test
 | 
					        #     # TODO: find another test
 | 
				
			||||||
        #     # http://schema.org/VideoObject
 | 
					        #     # http://schema.org/VideoObject
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue