Compare commits

..

No commits in common. "38e84a6ecaa857195b41858762c4edb09d64191a" and "bfe26b950586a05e8a5015eb5d450d1afa39b16e" have entirely different histories.

4 changed files with 36 additions and 21 deletions

View File

@ -197,7 +197,6 @@ class CBCPlayerIE(InfoExtractor):
'series': 'All in a Weekend Montreal',
'season': 'Season 2015',
'season_number': 2015,
'media_type': 'Excerpt',
},
}, {
'url': 'http://www.cbc.ca/player/play/2164402062',
@ -222,7 +221,6 @@ class CBCPlayerIE(InfoExtractor):
'cancer',
],
'creator': 'Allison Johnson',
'media_type': 'Excerpt',
},
}, {
# Has subtitles
@ -247,7 +245,6 @@ class CBCPlayerIE(InfoExtractor):
'tags': 'count:1',
'creator': 'News',
'location': 'Canada',
'media_type': 'Full Program',
},
}]

View File

@ -379,8 +379,6 @@ class InfoExtractor:
'private', 'premium_only', 'subscriber_only', 'needs_auth',
'unlisted' or 'public'. Use 'InfoExtractor._availability'
to set it
media_type: The type of media, for instance a full show, an excerpt, a highlight, a trailer
or something similar that classifies what kind of video or audio this is.
_old_archive_ids: A list of old archive ids needed for backward compatibility
_format_sort_fields: A list of fields to use for sorting formats
__post_extractor: A function to be called just before the metadata is

View File

@ -57,7 +57,6 @@ class NBCIE(ThePlatformIE): # XXX: Do not subclass from concrete IE
'Series/The Tonight Show Starring Jimmy Fallon'
],
'creator': None,
'media_type': 'Full Episode',
},
'params': {
'skip_download': 'm3u8',
@ -138,8 +137,7 @@ class NBCIE(ThePlatformIE): # XXX: Do not subclass from concrete IE
'thumbnail': r're:https?://.+\.jpg',
'categories': [
'Series/Quantum Leap 2022',
],
'media_type': 'Highlight',
]
},
'params': {
'skip_download': 'm3u8',

View File

@ -13,6 +13,7 @@ from ..utils import (
ExtractorError,
float_or_none,
int_or_none,
str_or_none,
parse_qs,
unsmuggle_url,
update_url_query,
@ -22,6 +23,7 @@ from ..utils import (
traverse_obj,
update_url,
urlhandle_detect_ext,
str_to_int,
)
from ..networking import HEADRequest
@ -103,14 +105,34 @@ class ThePlatformBaseIE(OnceIE):
for chapter in tp_chapters[:-1]:
_add_chapter(chapter.get('startTime'), chapter.get('endTime'))
_add_chapter(tp_chapters[-1].get('startTime'), tp_chapters[-1].get('endTime') or duration)
info_keywords_str = info.get('keywords', {str_or_none})
tags = []
if (info_keywords_str is not None) and (info_keywords_str != ''):
tags = re.split(', |; |,', info_keywords_str)
location = None
series = None
season_number = None
# The following can be uncommented as soon as #7838 is merged:
# media_type = None
categories = []
categories_data = info.get('categories') or []
for x in categories_data:
if x.get('name') is not None:
# Sometimes, there will be several kinds of categories
# in this case, it will have a label field with a value 'category'
if (x.get('label') is None) or (x.get('label') == 'category'):
categories.append(x.get('name'))
def extract_site_specific_field(field):
# A number of sites have custom-prefixed keys, e.g. 'cbc$seasonNumber'
return next((info[k] for k in info if k.endswith(f'${field}') and info[k] != ''), None)
return next((info[k] for k in info if k.endswith(f'${field}')), None)
info_media_type = extract_site_specific_field('programmingType')
if not info_media_type:
info_media_type = extract_site_specific_field('type')
location = extract_site_specific_field('region')
series = extract_site_specific_field('show')
season_number = int_or_none(extract_site_specific_field('seasonNumber'))
# the following can be uncommented as soon as #7838 is merged:
# if (re.match('.*\programmingType', key)) or (re.match('.*\type', key)):
# media_type = info[key]
return {
'title': info['title'],
@ -121,14 +143,14 @@ class ThePlatformBaseIE(OnceIE):
'timestamp': int_or_none(info.get('pubDate'), 1000) or None,
'uploader': info.get('billingCode'),
'chapters': chapters,
'creator': traverse_obj(info, ('author', {str})) or None,
'categories': traverse_obj(info, (
'categories', lambda _, v: v.get('label') in ('category', None), 'name', {str})) or None,
'tags': traverse_obj(info, ('keywords', {lambda x: re.split(r'[;,]\s?', x) if x else None})),
'location': extract_site_specific_field('region'),
'series': extract_site_specific_field('show'),
'season_number': int_or_none(extract_site_specific_field('seasonNumber')),
'media_type': info_media_type,
'creator': info.get('author', {str_or_none}) if info.get('author', {str_or_none}) != '' else None,
'categories': categories if len(categories) != 0 else None,
'tags': tags if len(tags) != 0 else None,
'location': str_or_none(location) if location != '' else None,
'series': str_or_none(series) if series != '' else None,
'season_number': int_or_none(season_number),
# The following can be uncommented as soon as #7838 is merged and the matching line above is uncommented
# 'media_type': media_type
}
def _extract_theplatform_metadata(self, path, video_id):