aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/dailymotion.py
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2019-07-01 08:37:21 +0100
committerRemita Amine <remitamine@gmail.com>2019-07-01 08:37:21 +0100
commit5e3da0d42b3d16465a95451276f021ecd0b7bd75 (patch)
treea30a7662356049144c4486462b03810f23598871 /youtube_dl/extractor/dailymotion.py
parentc5606802474822887b75af7de23de6679264c0fa (diff)
[dailymotion] add support embed with DM.player js call
Diffstat (limited to 'youtube_dl/extractor/dailymotion.py')
-rw-r--r--youtube_dl/extractor/dailymotion.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/youtube_dl/extractor/dailymotion.py b/youtube_dl/extractor/dailymotion.py
index 1a2c1308a..3d3d78041 100644
--- a/youtube_dl/extractor/dailymotion.py
+++ b/youtube_dl/extractor/dailymotion.py
@@ -137,10 +137,16 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
@staticmethod
def _extract_urls(webpage):
+ urls = []
# Look for embedded Dailymotion player
- matches = re.findall(
- r'<(?:(?:embed|iframe)[^>]+?src=|input[^>]+id=[\'"]dmcloudUrlEmissionSelect[\'"][^>]+value=)(["\'])(?P<url>(?:https?:)?//(?:www\.)?dailymotion\.com/(?:embed|swf)/video/.+?)\1', webpage)
- return list(map(lambda m: unescapeHTML(m[1]), matches))
+ # https://developer.dailymotion.com/player#player-parameters
+ for mobj in re.finditer(
+ 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):
video_id = self._match_id(url)