[france2.fr:generation-what] fix extraction

This commit is contained in:
Remita Amine 2017-11-25 15:49:49 +01:00
parent cd9ff4ec5b
commit 6f5c598a28

View File

@ -3,7 +3,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import re import re
import json
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_urlparse from ..compat import compat_urlparse
@ -308,31 +307,32 @@ class FranceTVInfoIE(FranceTVBaseInfoExtractor):
return self._extract_video(video_id, catalogue) return self._extract_video(video_id, catalogue)
class GenerationQuoiIE(InfoExtractor): class GenerationWhatIE(InfoExtractor):
IE_NAME = 'france2.fr:generation-quoi' IE_NAME = 'france2.fr:generation-what'
_VALID_URL = r'https?://generation-quoi\.france2\.fr/portrait/(?P<id>[^/?#]+)' _VALID_URL = r'https?://generation-what\.francetv\.fr/[^/]+/video/(?P<id>[^/?#]+)'
_TEST = { _TESTS = [{
'url': 'http://generation-quoi.france2.fr/portrait/garde-a-vous', 'url': 'http://generation-what.francetv.fr/portrait/video/present-arms',
'info_dict': { 'info_dict': {
'id': 'k7FJX8VBcvvLmX4wA5Q', 'id': 'wtvKYUG45iw',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Génération Quoi - Garde à Vous', 'title': 'Generation What - Garde à vous - FRA',
'uploader': 'Génération Quoi', 'uploader': 'Generation What',
'uploader_id': 'UCHH9p1eetWCgt4kXBYCb3_w',
'upload_date': '20160411',
}, },
'params': { }, {
# It uses Dailymotion 'url': 'http://generation-what.francetv.fr/europe/video/present-arms',
'skip_download': True, 'only_matching': True,
}, }]
}
def _real_extract(self, url): def _real_extract(self, url):
display_id = self._match_id(url) display_id = self._match_id(url)
info_url = compat_urlparse.urljoin(url, '/medias/video/%s.json' % display_id) webpage = self._download_webpage(url, display_id)
info_json = self._download_webpage(info_url, display_id) youtube_id = self._search_regex(
info = json.loads(info_json) r"window\.videoURL\s*=\s*'([0-9A-Za-z_-]{11})';",
return self.url_result('http://www.dailymotion.com/video/%s' % info['id'], webpage, 'youtube id')
ie='Dailymotion') return self.url_result(youtube_id, 'Youtube', youtube_id)
class CultureboxIE(FranceTVBaseInfoExtractor): class CultureboxIE(FranceTVBaseInfoExtractor):