projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d229ee7
)
[atresplayer] Extract subtitles
author
Sergey M․
<dstftw@gmail.com>
Fri, 23 Jan 2015 16:54:29 +0000
(22:54 +0600)
committer
Sergey M․
<dstftw@gmail.com>
Fri, 23 Jan 2015 16:54:29 +0000
(22:54 +0600)
youtube_dl/extractor/atresplayer.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/atresplayer.py
b/youtube_dl/extractor/atresplayer.py
index 8fd69b971052dc210e2098f889c7ac55ddfa9daf..f42862be31ffd047a6221403bd765e386e34e48d 100644
(file)
--- a/
youtube_dl/extractor/atresplayer.py
+++ b/
youtube_dl/extractor/atresplayer.py
@@
-3,7
+3,7
@@
from __future__ import unicode_literals
import time
import hmac
import time
import hmac
-from .
common import
InfoExtractor
+from .
subtitles import Subtitles
InfoExtractor
from ..compat import (
compat_str,
compat_urllib_parse,
from ..compat import (
compat_str,
compat_urllib_parse,
@@
-17,7
+17,7
@@
from ..utils import (
)
)
-class AtresPlayerIE(InfoExtractor):
+class AtresPlayerIE(
Subtitles
InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?atresplayer\.com/television/[^/]+/[^/]+/[^/]+/(?P<id>.+?)_\d+\.html'
_TESTS = [
{
_VALID_URL = r'https?://(?:www\.)?atresplayer\.com/television/[^/]+/[^/]+/[^/]+/(?P<id>.+?)_\d+\.html'
_TESTS = [
{
@@
-143,6
+143,15
@@
class AtresPlayerIE(InfoExtractor):
description = xpath_text(art, './description', 'description')
thumbnail = xpath_text(episode, './media/asset/files/background', 'thumbnail')
description = xpath_text(art, './description', 'description')
thumbnail = xpath_text(episode, './media/asset/files/background', 'thumbnail')
+ subtitles = {}
+ subtitle = xpath_text(episode, './media/asset/files/subtitle', 'subtitle')
+ if subtitle:
+ subtitles['es'] = subtitle
+
+ if self._downloader.params.get('listsubtitles', False):
+ self._list_available_subtitles(video_id, subtitles)
+ return
+
return {
'id': video_id,
'title': title,
return {
'id': video_id,
'title': title,
@@
-150,4
+159,5
@@
class AtresPlayerIE(InfoExtractor):
'thumbnail': thumbnail,
'duration': duration,
'formats': formats,
'thumbnail': thumbnail,
'duration': duration,
'formats': formats,
+ 'subtitles': self.extract_subtitles(video_id, subtitles),
}
}