mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-23 06:42:21 +00:00
QA
This commit is contained in:
parent
a61abdaa68
commit
8479922ba1
@ -117,7 +117,7 @@ class PanoptoBaseIE(InfoExtractor):
|
|||||||
class PanoptoIE(PanoptoBaseIE):
|
class PanoptoIE(PanoptoBaseIE):
|
||||||
_VALID_URL = PanoptoBaseIE.BASE_URL_RE + r'/Pages/(Viewer|Embed)\.aspx.*(?:\?|&)id=(?P<id>[a-f0-9-]+)'
|
_VALID_URL = PanoptoBaseIE.BASE_URL_RE + r'/Pages/(Viewer|Embed)\.aspx.*(?:\?|&)id=(?P<id>[a-f0-9-]+)'
|
||||||
_EMBED_REGEX = [
|
_EMBED_REGEX = [
|
||||||
r'''<iframe[^>]+src=["\'](?P<url>%s/Pages/(Viewer|Embed|Sessions/List)\.aspx[^"']+)'''
|
r'''<iframe\b[^>]+\bsrc\s*=\s*(["'])(?P<url>%s/Pages/(?:Viewer|Embed|Sessions/List)\.aspx(?:(?!\1)[\w\W])+)'''
|
||||||
% (PanoptoBaseIE.BASE_URL_RE, )]
|
% (PanoptoBaseIE.BASE_URL_RE, )]
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
@ -292,7 +292,7 @@ class PanoptoIE(PanoptoBaseIE):
|
|||||||
def _mark_watched(self, base_url, video_id, delivery_info):
|
def _mark_watched(self, base_url, video_id, delivery_info):
|
||||||
duration = traverse_obj(delivery_info, ('Delivery', 'Duration'), expected_type=float)
|
duration = traverse_obj(delivery_info, ('Delivery', 'Duration'), expected_type=float)
|
||||||
invocation_id = delivery_info.get('InvocationId')
|
invocation_id = delivery_info.get('InvocationId')
|
||||||
stream_id = traverse_obj(delivery_info, ('Delivery', 'Streams', Ellipsis, 'PublicID'), get_all=False, expected_type=str)
|
stream_id = traverse_obj(delivery_info, ('Delivery', 'Streams', Ellipsis, 'PublicID'), get_all=False, expected_type=compat_str)
|
||||||
if invocation_id and stream_id and duration:
|
if invocation_id and stream_id and duration:
|
||||||
timestamp_str = '/Date(%s000)/' % (calendar.timegm(datetime.utcnow().timetuple()), )
|
timestamp_str = '/Date(%s000)/' % (calendar.timegm(datetime.utcnow().timetuple()), )
|
||||||
data = {
|
data = {
|
||||||
@ -517,7 +517,6 @@ class PanoptoPlaylistIE(PanoptoBaseIE):
|
|||||||
},
|
},
|
||||||
'playlist_mincount': 4
|
'playlist_mincount': 4
|
||||||
},
|
},
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def _entries(self, base_url, playlist_id, session_list_id):
|
def _entries(self, base_url, playlist_id, session_list_id):
|
||||||
@ -531,16 +530,13 @@ class PanoptoPlaylistIE(PanoptoBaseIE):
|
|||||||
if item.get('TypeName') != 'Session':
|
if item.get('TypeName') != 'Session':
|
||||||
self.report_warning('Got an item in the playlist that is not a Session' + bug_reports_message(), only_once=True)
|
self.report_warning('Got an item in the playlist that is not a Session' + bug_reports_message(), only_once=True)
|
||||||
continue
|
continue
|
||||||
yield {
|
yield merge_dicts(
|
||||||
'_type': 'url',
|
self.url_result(item.get('ViewerUri'), item.get('Id'), item.get('Name')), {
|
||||||
'id': item.get('Id'),
|
'description': item.get('Description'),
|
||||||
'url': item.get('ViewerUri'),
|
'duration': item.get('Duration'),
|
||||||
'title': item.get('Name'),
|
'channel': traverse_obj(item, ('Parent', 'Name')),
|
||||||
'description': item.get('Description'),
|
'channel_id': traverse_obj(item, ('Parent', 'Id'))
|
||||||
'duration': item.get('Duration'),
|
})
|
||||||
'channel': traverse_obj(item, ('Parent', 'Name')),
|
|
||||||
'channel_id': traverse_obj(item, ('Parent', 'Id'))
|
|
||||||
}
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
base_url, playlist_id = self._match_valid_url(url).group('base_url', 'id')
|
base_url, playlist_id = self._match_valid_url(url).group('base_url', 'id')
|
||||||
@ -594,7 +590,6 @@ class PanoptoListIE(PanoptoBaseIE):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def _fetch_page(self, base_url, query_params, display_id, page):
|
def _fetch_page(self, base_url, query_params, display_id, page):
|
||||||
|
|
||||||
params = merge_dicts({
|
params = merge_dicts({
|
||||||
'page': page,
|
'page': page,
|
||||||
'maxResults': self._PAGE_SIZE,
|
'maxResults': self._PAGE_SIZE,
|
||||||
@ -611,17 +606,15 @@ class PanoptoListIE(PanoptoBaseIE):
|
|||||||
for result in get_first(response, 'Results', default=[]):
|
for result in get_first(response, 'Results', default=[]):
|
||||||
# This could be a video, playlist (or maybe something else)
|
# This could be a video, playlist (or maybe something else)
|
||||||
item_id = result.get('DeliveryID')
|
item_id = result.get('DeliveryID')
|
||||||
yield {
|
yield merge_dicts(
|
||||||
'_type': 'url',
|
self.url_result(
|
||||||
'id': item_id,
|
|
||||||
'title': result.get('SessionName'),
|
|
||||||
'url': (
|
|
||||||
traverse_obj(result, 'ViewerUrl', 'EmbedUrl', get_all=False)
|
traverse_obj(result, 'ViewerUrl', 'EmbedUrl', get_all=False)
|
||||||
or update_url_query(base_url + '/Pages/Viewer.aspx', {'id': item_id})),
|
or update_url_query(base_url + '/Pages/Viewer.aspx', {'id': item_id}),
|
||||||
'duration': result.get('Duration'),
|
item_id, result.get('SessionName')), {
|
||||||
'channel': result.get('FolderName'),
|
'duration': result.get('Duration'),
|
||||||
'channel_id': result.get('FolderID'),
|
'channel': result.get('FolderName'),
|
||||||
}
|
'channel_id': result.get('FolderID'),
|
||||||
|
})
|
||||||
|
|
||||||
for folder in get_first(response, 'Subfolders', default=[]):
|
for folder in get_first(response, 'Subfolders', default=[]):
|
||||||
folder_id = folder.get('ID')
|
folder_id = folder.get('ID')
|
||||||
|
Loading…
Reference in New Issue
Block a user