mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-10 19:37:25 +00:00
[npo] Convert to new subtitles system
This commit is contained in:
parent
311c393838
commit
b9b42f2ea0
@ -19,6 +19,7 @@ from youtube_dl.extractor import (
|
|||||||
WallaIE,
|
WallaIE,
|
||||||
CeskaTelevizeIE,
|
CeskaTelevizeIE,
|
||||||
LyndaIE,
|
LyndaIE,
|
||||||
|
NPOIE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -317,5 +318,17 @@ class TestLyndaSubtitles(BaseTestSubtitles):
|
|||||||
self.assertEqual(md5(subtitles['en']), '09bbe67222259bed60deaa26997d73a7')
|
self.assertEqual(md5(subtitles['en']), '09bbe67222259bed60deaa26997d73a7')
|
||||||
|
|
||||||
|
|
||||||
|
class TestNPOSubtitles(BaseTestSubtitles):
|
||||||
|
url = 'http://www.npo.nl/nos-journaal/28-08-2014/POW_00722860'
|
||||||
|
IE = NPOIE
|
||||||
|
|
||||||
|
def test_allsubtitles(self):
|
||||||
|
self.DL.params['writesubtitles'] = True
|
||||||
|
self.DL.params['allsubtitles'] = True
|
||||||
|
subtitles = self.getSubtitles()
|
||||||
|
self.assertEqual(set(subtitles.keys()), set(['nl']))
|
||||||
|
self.assertEqual(md5(subtitles['nl']), 'fc6435027572b63fb4ab143abd5ad3f4')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .subtitles import SubtitlesInfoExtractor
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
fix_xml_ampersands,
|
fix_xml_ampersands,
|
||||||
@ -12,7 +11,7 @@ from ..utils import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class NPOBaseIE(SubtitlesInfoExtractor):
|
class NPOBaseIE(InfoExtractor):
|
||||||
def _get_token(self, video_id):
|
def _get_token(self, video_id):
|
||||||
token_page = self._download_webpage(
|
token_page = self._download_webpage(
|
||||||
'http://ida.omroep.nl/npoplayer/i.js',
|
'http://ida.omroep.nl/npoplayer/i.js',
|
||||||
@ -164,13 +163,10 @@ class NPOIE(NPOBaseIE):
|
|||||||
|
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
if metadata.get('tt888') == 'ja':
|
if metadata.get('tt888') == 'ja':
|
||||||
subtitles['nl'] = 'http://e.omroep.nl/tt888/%s' % video_id
|
subtitles['nl'] = [{
|
||||||
|
'ext': 'vtt',
|
||||||
if self._downloader.params.get('listsubtitles', False):
|
'url': 'http://e.omroep.nl/tt888/%s' % video_id,
|
||||||
self._list_available_subtitles(video_id, subtitles)
|
}]
|
||||||
return
|
|
||||||
|
|
||||||
subtitles = self.extract_subtitles(video_id, subtitles)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user