From 6aeba407db84a636fc2522b4f2344eac9e0c1fdb Mon Sep 17 00:00:00 2001
From: remitamine
Date: Fri, 25 Sep 2015 10:52:48 +0100
Subject: [PATCH 1/2] [jukebox] remove extractor and handle it using generic
extractor
---
youtube_dl/extractor/__init__.py | 1 -
youtube_dl/extractor/generic.py | 21 +++++++
youtube_dl/extractor/jukebox.py | 59 ------------------
youtube_dl/extractor/ultimedia.py | 99 +++++++++++++------------------
4 files changed, 61 insertions(+), 119 deletions(-)
delete mode 100644 youtube_dl/extractor/jukebox.py
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py
index 7272859db..1813c7e1b 100644
--- a/youtube_dl/extractor/__init__.py
+++ b/youtube_dl/extractor/__init__.py
@@ -262,7 +262,6 @@ from .izlesene import IzleseneIE
from .jadorecettepub import JadoreCettePubIE
from .jeuxvideo import JeuxVideoIE
from .jove import JoveIE
-from .jukebox import JukeboxIE
from .jpopsukitv import JpopsukiIE
from .kaltura import KalturaIE
from .kanalplay import KanalPlayIE
diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py
index 8881a8a23..4d1f75e63 100644
--- a/youtube_dl/extractor/generic.py
+++ b/youtube_dl/extractor/generic.py
@@ -50,6 +50,7 @@ from .dailymotion import DailymotionCloudIE
from .onionstudios import OnionStudiosIE
from .snagfilms import SnagFilmsEmbedIE
from .screenwavemedia import ScreenwaveMediaIE
+from .ultimedia import UltimediaIE
class GenericIE(InfoExtractor):
@@ -1029,6 +1030,21 @@ class GenericIE(InfoExtractor):
'ext': 'mp4',
'title': 'cinemasnob',
},
+ },
+ # Ultimedia embed
+ {
+ 'url': 'http://www.jukebox.es/kosheen/videoclip,pride,r303r.html',
+ 'md5': '25551df6e7c7ab8096ceeeae048c5f64',
+ 'info_dict': {
+ 'id': 'r303r',
+ 'ext': 'mp4',
+ 'title': 'Kosheen - Pride (live)',
+ 'thumbnail': 're:^https?://.*\.jpg',
+ 'duration': 293,
+ 'upload_date': '20081103',
+ 'timestamp': 1225733392,
+ 'uploader_id': '33m03',
+ },
}
]
@@ -1751,6 +1767,11 @@ class GenericIE(InfoExtractor):
if mobj is not None:
return self.url_result(unescapeHTML(mobj.group('url')), 'ScreenwaveMedia')
+ # Look for Ulltimedia embeds
+ ultimedia_url = UltimediaIE._extract_url(webpage)
+ if ultimedia_url:
+ return self.url_result(self._proto_relative_url(ultimedia_url), 'Ultimedia')
+
# Look for AdobeTVVideo embeds
mobj = re.search(
r'
', webpage,
- 'description', fatal=False))
-
- upload_date = unified_strdate(self._search_regex(
- r'Ajouté le\s*([^<]+)', webpage,
- 'upload date', fatal=False))
+ title = deliver_info['title']
+ thumbnail = jwconf.get('image')
+ duration = int_or_none(deliver_info.get('duration'))
+ timestamp = int_or_none(deliver_info.get('release_time'))
+ uploader_id = deliver_info.get('owner_id')
return {
'id': video_id,
'title': title,
- 'description': description,
'thumbnail': thumbnail,
- 'upload_date': upload_date,
+ 'duration': duration,
+ 'timestamp': timestamp,
+ 'uploader_id': uploader_id,
'formats': formats,
}
From 3da3999612311ff193890072727208892b9e93f0 Mon Sep 17 00:00:00 2001
From: remitamine
Date: Thu, 10 Dec 2015 23:04:28 +0100
Subject: [PATCH 2/2] [ultimedia] keep direct support for ultimedia videos
---
youtube_dl/extractor/ultimedia.py | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/youtube_dl/extractor/ultimedia.py b/youtube_dl/extractor/ultimedia.py
index 45201332d..60328123c 100644
--- a/youtube_dl/extractor/ultimedia.py
+++ b/youtube_dl/extractor/ultimedia.py
@@ -8,10 +8,29 @@ from ..utils import int_or_none
class UltimediaIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?ultimedia\.com/deliver/(?Pgeneric|musique)(?:/[^/]+)*/(?:src|article)/(?P[\d+a-z]+)'
+ _VALID_URL = r'''(?x)
+ https?://(?:www\.)?ultimedia\.com/
+ (?:
+ deliver/
+ (?P
+ generic|
+ musique
+ )
+ (?:/[^/]+)*/
+ (?:
+ src|
+ article
+ )|
+ default/index/video
+ (?P
+ generic|
+ music
+ )
+ /id
+ )/(?P[\d+a-z]+)'''
_TESTS = [{
# news
- 'url': 'https://www.ultimedia.com/deliver/generic/iframe/mdtk/01601930/zone/1/src/s8uk0r/autoplay/yes/ad/no/width/714/height/435',
+ 'url': 'https://www.ultimedia.com/default/index/videogeneric/id/s8uk0r',
'md5': '276a0e49de58c7e85d32b057837952a2',
'info_dict': {
'id': 's8uk0r',
@@ -25,7 +44,7 @@ class UltimediaIE(InfoExtractor):
},
}, {
# music
- 'url': 'https://www.ultimedia.com/deliver/musique/iframe/mdtk/01601930/zone/1/article/xvpfp8/autoplay/yes/ad/no/width/714/height/435',
+ 'url': 'https://www.ultimedia.com/default/index/videomusic/id/xvpfp8',
'md5': '2ea3513813cf230605c7e2ffe7eca61c',
'info_dict': {
'id': 'xvpfp8',
@@ -48,7 +67,11 @@ class UltimediaIE(InfoExtractor):
return mobj.group('url')
def _real_extract(self, url):
- video_type, video_id = re.match(self._VALID_URL, url).groups()
+ mobj = re.match(self._VALID_URL, url)
+ video_id = mobj.group('id')
+ video_type = mobj.group('embed_type') or mobj.group('site_type')
+ if video_type == 'music':
+ video_type = 'musique'
deliver_info = self._download_json(
'http://www.ultimedia.com/deliver/video?video=%s&topic=%s' % (video_id, video_type),