mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-02 16:37:59 +09:00
Coding standard: Use try_get.
This commit is contained in:
parent
d4512dfd52
commit
5987eb1302
@ -3,6 +3,7 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import compat_str
|
from ..compat import compat_str
|
||||||
|
from ..utils import try_get
|
||||||
|
|
||||||
|
|
||||||
class Pac12IE(InfoExtractor):
|
class Pac12IE(InfoExtractor):
|
||||||
@ -41,14 +42,12 @@ class Pac12IE(InfoExtractor):
|
|||||||
|
|
||||||
if cv is False:
|
if cv is False:
|
||||||
# May be an event page; look for the live stream.
|
# May be an event page; look for the live stream.
|
||||||
try:
|
network = try_get(drupal_settings, lambda x: x['pac12_react'][
|
||||||
network = drupal_settings['pac12_react'][
|
'pac12_react_event_widget']['event']['broadcast_info'][
|
||||||
'pac12_react_event_widget']['event'][
|
'broadcast_networks'][0]['id'], int)
|
||||||
'broadcast_info']['broadcast_networks'][0]['id']
|
if network is not None:
|
||||||
cv = drupal_settings['pac12_react']['networks'][str(network)]
|
cv = try_get(drupal_settings, lambda x: x['pac12_react'
|
||||||
except (KeyError, IndexError):
|
]['networks'][str(network)], dict)
|
||||||
# Can't find a live stream this way.
|
|
||||||
pass
|
|
||||||
|
|
||||||
if not cv or 'manifest_url' not in cv:
|
if not cv or 'manifest_url' not in cv:
|
||||||
# Video may be embedded one level deeper; look for embed URL.
|
# Video may be embedded one level deeper; look for embed URL.
|
||||||
|
Loading…
Reference in New Issue
Block a user