mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-02 09:12:40 +01:00
[adultswim] Extract video info from onlineOriginals (Closes #10492)
This commit is contained in:
parent
cd10b3ea63
commit
3fb2a23029
@ -4,7 +4,10 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .turner import TurnerBaseIE
|
from .turner import TurnerBaseIE
|
||||||
from ..utils import ExtractorError
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
int_or_none,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AdultSwimIE(TurnerBaseIE):
|
class AdultSwimIE(TurnerBaseIE):
|
||||||
@ -144,7 +147,10 @@ def _real_extract(self, url):
|
|||||||
if bootstrapped_data.get('slugged_video', {}).get('slug') == episode_path:
|
if bootstrapped_data.get('slugged_video', {}).get('slug') == episode_path:
|
||||||
video_info = bootstrapped_data['slugged_video']
|
video_info = bootstrapped_data['slugged_video']
|
||||||
if not video_info:
|
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:
|
if not video_info:
|
||||||
raise ExtractorError('Unable to find video info')
|
raise ExtractorError('Unable to find video info')
|
||||||
|
|
||||||
@ -167,8 +173,9 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
episode_id = video_info['id']
|
episode_id = video_info['id']
|
||||||
episode_title = video_info['title']
|
episode_title = video_info['title']
|
||||||
episode_description = video_info['description']
|
episode_description = video_info.get('description')
|
||||||
episode_duration = video_info.get('duration')
|
episode_duration = int_or_none(video_info.get('duration'))
|
||||||
|
view_count = int_or_none(video_info.get('views'))
|
||||||
|
|
||||||
entries = []
|
entries = []
|
||||||
for part_num, segment_id in enumerate(segment_ids):
|
for part_num, segment_id in enumerate(segment_ids):
|
||||||
@ -197,5 +204,6 @@ def _real_extract(self, url):
|
|||||||
'entries': entries,
|
'entries': entries,
|
||||||
'title': '%s - %s' % (show_title, episode_title),
|
'title': '%s - %s' % (show_title, episode_title),
|
||||||
'description': episode_description,
|
'description': episode_description,
|
||||||
'duration': episode_duration
|
'duration': episode_duration,
|
||||||
|
'view_count': view_count,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user