aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/adultswim.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-08-29 22:40:35 +0700
committerSergey M․ <dstftw@gmail.com>2016-08-29 22:40:35 +0700
commit3fb2a23029934dcbf6fe2cd283d851506dcdff5e (patch)
tree56f980929b85a42949264a2dc6078772b2dbb82d /youtube_dl/extractor/adultswim.py
parentcd10b3ea63fd167216234932aba4d63a34aec4c7 (diff)
[adultswim] Extract video info from onlineOriginals (Closes #10492)
Diffstat (limited to 'youtube_dl/extractor/adultswim.py')
-rw-r--r--youtube_dl/extractor/adultswim.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/youtube_dl/extractor/adultswim.py b/youtube_dl/extractor/adultswim.py
index ef3cc2a61..5d0bf5a68 100644
--- a/youtube_dl/extractor/adultswim.py
+++ b/youtube_dl/extractor/adultswim.py
@@ -4,7 +4,10 @@ from __future__ import unicode_literals
import re
from .turner import TurnerBaseIE
-from ..utils import ExtractorError
+from ..utils import (
+ ExtractorError,
+ int_or_none,
+)
class AdultSwimIE(TurnerBaseIE):
@@ -144,7 +147,10 @@ class AdultSwimIE(TurnerBaseIE):
if bootstrapped_data.get('slugged_video', {}).get('slug') == episode_path:
video_info = bootstrapped_data['slugged_video']
if not video_info:
- video_info = bootstrapped_data.get('heroMetadata', {}).get('trailer').get('video')
+ video_info = bootstrapped_data.get(
+ 'heroMetadata', {}).get('trailer', {}).get('video')
+ if not video_info:
+ video_info = bootstrapped_data.get('onlineOriginals', [None])[0]
if not video_info:
raise ExtractorError('Unable to find video info')
@@ -167,8 +173,9 @@ class AdultSwimIE(TurnerBaseIE):
episode_id = video_info['id']
episode_title = video_info['title']
- episode_description = video_info['description']
- episode_duration = video_info.get('duration')
+ episode_description = video_info.get('description')
+ episode_duration = int_or_none(video_info.get('duration'))
+ view_count = int_or_none(video_info.get('views'))
entries = []
for part_num, segment_id in enumerate(segment_ids):
@@ -197,5 +204,6 @@ class AdultSwimIE(TurnerBaseIE):
'entries': entries,
'title': '%s - %s' % (show_title, episode_title),
'description': episode_description,
- 'duration': episode_duration
+ 'duration': episode_duration,
+ 'view_count': view_count,
}