]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
Merge branch 'master' into subtitles_rework
authorIsmael Mejia <iemejia@gmail.com>
Fri, 6 Sep 2013 21:23:23 +0000 (23:23 +0200)
committerIsmael Mejia <iemejia@gmail.com>
Fri, 6 Sep 2013 21:24:41 +0000 (23:24 +0200)
1  2 
youtube_dl/__init__.py
youtube_dl/extractor/dailymotion.py
youtube_dl/extractor/youtube.py

Simple merge
index 003b1d8c3e6233368b764e2866431cde13e032f3,3c616e0896cecc33077c9bd7ae0c9b15c5d4ddbd..f7dffd4cce3a1fc2d04bd016111aa354717072a6
@@@ -17,27 -11,10 +17,27 @@@ from ..utils import 
      ExtractorError,
  )
  
 -class DailymotionIE(InfoExtractor):
 +
 +class DailyMotionSubtitlesIE(NoAutoSubtitlesIE):
 +
 +    def _get_available_subtitles(self, video_id):
 +        request = compat_urllib_request.Request('https://api.dailymotion.com/video/%s/subtitles?fields=id,language,url' % video_id)
 +        try:
 +            sub_list = compat_urllib_request.urlopen(request).read().decode('utf-8')
 +        except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
 +            self._downloader.report_warning(u'unable to download video subtitles: %s' % compat_str(err))
 +            return {}
 +        info = json.loads(sub_list)
 +        if (info['total'] > 0):
 +            sub_lang_list = dict((l['language'], l['url']) for l in info['list'])
 +            return sub_lang_list
 +        self._downloader.report_warning(u'video doesn\'t have subtitles')
 +        return {}
 +
 +class DailymotionIE(DailyMotionSubtitlesIE, InfoExtractor):
      """Information Extractor for Dailymotion"""
  
-     _VALID_URL = r'(?i)(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/video/([^/]+)'
+     _VALID_URL = r'(?i)(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/(?:embed/)?video/([^/]+)'
      IE_NAME = u'dailymotion'
      _TEST = {
          u'url': u'http://www.dailymotion.com/video/x33vw9_tutoriel-de-youtubeur-dl-des-video_tech',
Simple merge