diff options
author | Sergey M․ <dstftw@gmail.com> | 2014-03-03 18:05:46 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2014-03-03 18:05:46 +0700 |
commit | 2acc1f8f50065aeb6a904b5b14e1e6d5b79a1484 (patch) | |
tree | ff691c47a0ab6bbded5944e311835dcb954356c1 /youtube_dl/extractor/orf.py | |
parent | 2c39b0c695f4bd2a7f45c4818827fad4aaa6f0dc (diff) |
[orf] Fix segments extraction (Closes #2501)
Diffstat (limited to 'youtube_dl/extractor/orf.py')
-rw-r--r-- | youtube_dl/extractor/orf.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/youtube_dl/extractor/orf.py b/youtube_dl/extractor/orf.py index 5f5694393..03421d1d5 100644 --- a/youtube_dl/extractor/orf.py +++ b/youtube_dl/extractor/orf.py @@ -8,6 +8,7 @@ from .common import InfoExtractor from ..utils import ( HEADRequest, unified_strdate, + ExtractorError, ) @@ -35,7 +36,15 @@ class ORFIE(InfoExtractor): data_json = self._search_regex( r'initializeAdworx\((.+?)\);\n', webpage, 'video info') all_data = json.loads(data_json) - sdata = all_data[0]['values']['segments'] + + def get_segments(all_data): + for data in all_data: + if data['name'] == 'Tracker::EPISODE_DETAIL_PAGE_OVER_PROGRAM': + return data['values']['segments'] + + sdata = get_segments(all_data) + if not sdata: + raise ExtractorError('Unable to extract segments') def quality_to_int(s): m = re.search('([0-9]+)', s) |