]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[crunchyroll] Allow to list subtitles (fixes #3805)
authorNaglis Jonaitis <njonaitis@gmail.com>
Thu, 25 Sep 2014 14:57:38 +0000 (17:57 +0300)
committerNaglis Jonaitis <njonaitis@gmail.com>
Thu, 25 Sep 2014 14:57:38 +0000 (17:57 +0300)
youtube_dl/extractor/crunchyroll.py

index 4903764f7008ec6f22c054cda2c73557c44b2a91..f99888ecc378ea2a5404fe42d8d32a6a8c4093fb 100644 (file)
@@ -9,7 +9,7 @@ import xml.etree.ElementTree
 
 from hashlib import sha1
 from math import pow, sqrt, floor
-from .common import InfoExtractor
+from .subtitles import SubtitlesInfoExtractor
 from ..utils import (
     ExtractorError,
     compat_urllib_parse,
@@ -26,7 +26,7 @@ from ..aes import (
 )
 
 
-class CrunchyrollIE(InfoExtractor):
+class CrunchyrollIE(SubtitlesInfoExtractor):
     _VALID_URL = r'https?://(?:(?P<prefix>www|m)\.)?(?P<url>crunchyroll\.com/(?:[^/]*/[^/?&]*?|media/\?id=)(?P<video_id>[0-9]+))(?:[/?&]|$)'
     _TEST = {
         'url': 'http://www.crunchyroll.com/wanna-be-the-strongest-in-the-world/episode-1-an-idol-wrestler-is-born-645513',
@@ -271,6 +271,10 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
             else:
                 subtitles[lang_code] = self._convert_subtitles_to_srt(subtitle)
 
+        if self._downloader.params.get('listsubtitles', False):
+            self._list_available_subtitles(video_id, subtitles)
+            return
+
         return {
             'id':          video_id,
             'title':       video_title,