mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-11 02:27:14 +08:00
[ciscolive] Requested changes
This commit is contained in:
parent
b207f39ee5
commit
7554015f86
@ -2,8 +2,12 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
from ..compat import compat_urllib_parse_urlencode
|
||||
from .common import InfoExtractor
|
||||
from ..compat import compat_urllib_parse_urlencode
|
||||
from ..utils import (
|
||||
try_get,
|
||||
clean_html
|
||||
)
|
||||
|
||||
|
||||
class CiscoLiveIE(InfoExtractor):
|
||||
@ -17,7 +21,7 @@ class CiscoLiveIE(InfoExtractor):
|
||||
'id': '5803694304001',
|
||||
'ext': 'mp4',
|
||||
'title': '13 Smart Automations to Monitor Your Cisco IOS Network [BRKNMS-2465]',
|
||||
'description': 'md5:9c8b286dea1e3cb479c4562f1c3e5000',
|
||||
'description': 'md5:171c3a1c0469c126d01f083a83d6c60b',
|
||||
'timestamp': 1530305395,
|
||||
'uploader_id': '5647924234001',
|
||||
'upload_date': '20180629',
|
||||
@ -33,7 +37,7 @@ class CiscoLiveIE(InfoExtractor):
|
||||
'timestamp': 1530316421,
|
||||
'uploader_id': '5647924234001',
|
||||
'id': '5803751616001',
|
||||
'description': 'md5:df02755cc961cc38950c36f53849ff1b',
|
||||
'description': 'md5:291dbd447bf745d1f61d944d9508538f',
|
||||
'location': 'WoS, DevNet Theater',
|
||||
'ext': 'mp4',
|
||||
},
|
||||
@ -47,7 +51,7 @@ class CiscoLiveIE(InfoExtractor):
|
||||
'timestamp': 1530311842,
|
||||
'uploader_id': '5647924234001',
|
||||
'id': '5803735679001',
|
||||
'description': 'md5:9e05b6772263276a5b8feef6f04887a1',
|
||||
'description': 'md5:18bf6e8a634df0a51290401f209089b0',
|
||||
'location': 'Tulúm 02',
|
||||
'ext': 'mp4',
|
||||
},
|
||||
@ -77,50 +81,48 @@ class CiscoLiveIE(InfoExtractor):
|
||||
# Cisco Live ID - Shorthand session ID [BRKCRS-2501]
|
||||
title = rf_item.get('title')
|
||||
# Full session title [Campus QoS Design-Simplified]
|
||||
description = rf_item.get('abstract')
|
||||
description = clean_html(rf_item.get('abstract'))
|
||||
# Description [This session will apply Cisco's QoS strategy for rich media...]
|
||||
presenter_name = rf_item.get('participants')[0].get('fullName')
|
||||
presenter_name = try_get(rf_item, lambda x: x['participants'][0]['fullName'])
|
||||
# Presenter's full name [Tim Szigeti]
|
||||
presenter_title = rf_item.get('participants')[0].get('jobTitle')
|
||||
presenter_title = try_get(rf_item, lambda x: x['participants'][0]['jobTitle'])
|
||||
# Presenter's job title [Principal Engineer - Technical Marketing]
|
||||
pdf_url = rf_item.get('files')[0].get('url')
|
||||
pdf_url = try_get(rf_item, lambda x: x['files'][0]['url'])
|
||||
# Presentation PDF URL [https://clnv.s3.amazonaws.com/2016/eur/pdf/BRKCRS-2501.pdf]
|
||||
bc_id = rf_item.get('videos')[0].get('url')
|
||||
bc_id = try_get(rf_item, lambda x: x['videos'][0]['url'])
|
||||
# Brightcove video ID [5803710412001]
|
||||
bc_url = self.BRIGHTCOVE_URL_TEMPLATE % bc_id
|
||||
# Brightcove video URL [http://players.brightcove.net/5647924234001/SyK2FdqjM_default/index.html?videoId=5803710412001]
|
||||
duration = rf_item.get('times')[0].get('length') * 60
|
||||
duration = try_get(rf_item, lambda x: x['times'][0]['length'])
|
||||
# Duration. Provided in minutes * 60 = seconds [7200]
|
||||
location = rf_item.get('times')[0].get('room')
|
||||
location = try_get(rf_item, lambda x: x['times'][0]['room'])
|
||||
# Location [Hall 7.3 Breakout Room 732]
|
||||
|
||||
if duration:
|
||||
duration = duration * 60
|
||||
|
||||
return {
|
||||
'_type': 'url_transparent',
|
||||
'url': bc_url,
|
||||
'id': cl_id,
|
||||
'title': '%s [%s]' % (title, cl_id),
|
||||
'creator': '%s, %s' % (presenter_name, presenter_title),
|
||||
'description': '%s\nVideo Player: %s\nSlide Deck: %s' % (description, bc_url, pdf_url),
|
||||
'description': '%s\n\nVideo Player: %s\nSlide Deck: %s' % (description, bc_url, pdf_url),
|
||||
'series': event_name,
|
||||
'duration': duration,
|
||||
'location': location,
|
||||
'ie_key': 'BrightcoveNew',
|
||||
}
|
||||
|
||||
def _check_bc_url_exists(self, rf_item):
|
||||
def _check_bc_id_exists(self, rf_item):
|
||||
''' Checks for the existence of a Brightcove URL in a
|
||||
RainFocus result item
|
||||
|
||||
'''
|
||||
try:
|
||||
bc_id = rf_item['videos'][0]['url']
|
||||
bc_id = try_get(rf_item, lambda x: x['videos'][0]['url'])
|
||||
mobj = re.match(r'\d+', bc_id)
|
||||
if mobj:
|
||||
return rf_item
|
||||
else:
|
||||
pass
|
||||
except IndexError:
|
||||
pass
|
||||
|
||||
def _real_extract(self, url):
|
||||
mobj = re.match(self._VALID_URL, url)
|
||||
@ -138,7 +140,7 @@ class CiscoLiveIE(InfoExtractor):
|
||||
data = compat_urllib_parse_urlencode({'id': rf_id})
|
||||
rf_result = self._download_json(request, rf_id, data=data,
|
||||
headers=headers)
|
||||
rf_item = self._check_bc_url_exists(rf_result.get('items')[0])
|
||||
rf_item = self._check_bc_id_exists(try_get(rf_result, lambda x: x['items'][0], dict))
|
||||
return self._parse_rf_item(rf_item)
|
||||
else:
|
||||
# Filter query URL (multiple videos)
|
||||
@ -151,8 +153,8 @@ class CiscoLiveIE(InfoExtractor):
|
||||
# Not all sessions have videos; filter them out before moving on
|
||||
rf_video_results = [
|
||||
rf_item
|
||||
for rf_item in rf_results.get('sectionList')[0].get('items')
|
||||
if self._check_bc_url_exists(rf_item)
|
||||
for rf_item in try_get(rf_results, lambda x: x['sectionList'][0]['items'], list)
|
||||
if self._check_bc_id_exists(rf_item)
|
||||
]
|
||||
entries = [self._parse_rf_item(rf_item) for rf_item in rf_video_results]
|
||||
return self.playlist_result(entries, 'Filter query')
|
||||
|
Loading…
x
Reference in New Issue
Block a user