Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/yt-dlp/yt-dlp into ytdlp
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/yt-dlp/yt-dlp:
  [NovaEmbed] update player regex (#2008)
  [brightcove] Fix 487c5b3
  [tiktok] Fix 53dad39
  [extractor] Standardize `_live_title`
  • Loading branch information
Lesmiscore committed Dec 16, 2021
2 parents 6e5c0cf + fe69f52 commit 706144f
Show file tree
Hide file tree
Showing 69 changed files with 72 additions and 102 deletions.
3 changes: 3 additions & 0 deletions yt_dlp/YoutubeDL.py
Original file line number Diff line number Diff line change
Expand Up @@ -2822,6 +2822,9 @@ def process_info(self, info_dict):
if self._num_downloads >= int(max_downloads):
raise MaxDownloadsReached()

if info_dict.get('is_live'):
info_dict['title'] += ' ' + datetime.datetime.now().strftime('%Y-%m-%d %H:%M')

# TODO: backward compatibility, to be removed
info_dict['fulltitle'] = info_dict['title']

Expand Down
2 changes: 0 additions & 2 deletions yt_dlp/extractor/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ def tokenize_url(url, token):
}]

is_live = video_params.get('livestream') == '1'
if is_live:
title = self._live_title(title)

return {
'id': video_id,
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/adobeconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def _real_extract(self, url):

return {
'id': video_id,
'title': self._live_title(title) if is_live else title,
'title': title,
'formats': formats,
'is_live': is_live,
}
2 changes: 1 addition & 1 deletion yt_dlp/extractor/arcpublishing.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def _real_extract(self, url):

return {
'id': uuid,
'title': self._live_title(title) if is_live else title,
'title': title,
'thumbnail': try_get(video, lambda x: x['promo_image']['url']),
'description': try_get(video, lambda x: x['subheadlines']['basic']),
'formats': formats,
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/ard.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def _real_extract(self, url):

info.update({
'id': video_id,
'title': self._live_title(title) if info.get('is_live') else title,
'title': title,
'description': description,
'thumbnail': thumbnail,
})
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/awaan.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _parse_video_data(self, video_data, video_id, is_live):

return {
'id': video_id,
'title': self._live_title(title) if is_live else title,
'title': title,
'description': video_data.get('description_en') or video_data.get('description_ar'),
'thumbnail': 'http://admin.mangomolo.com/analytics/%s' % img if img else None,
'duration': int_or_none(video_data.get('duration')),
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/bitwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _real_extract(self, url):

return {
'id': username,
'title': self._live_title(channel['data']['title']),
'title': channel['data']['title'],
'uploader': username,
'uploader_id': username,
'formats': formats,
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/bongacams.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _real_extract(self, url):

return {
'id': channel_id,
'title': self._live_title(uploader or uploader_id),
'title': uploader or uploader_id,
'uploader': uploader,
'uploader_id': uploader_id,
'like_count': like_count,
Expand Down
5 changes: 2 additions & 3 deletions yt_dlp/extractor/brightcove.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,10 +581,9 @@ def build_format_id(kind):

return {
'id': video_id,
'title': self._live_title(title) if is_live else title,
'title': title,
'description': clean_html(json_data.get('description')),
'thumbnail': json_data.get('thumbnail') or json_data.get('poster'),
'thumbnials': thumbnails,
'thumbnails': thumbnails,
'duration': duration,
'timestamp': parse_iso8601(json_data.get('published_at')),
'uploader_id': json_data.get('account_id'),
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/cam4.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def _real_extract(self, url):

return {
'id': channel_id,
'title': self._live_title(channel_id),
'title': channel_id,
'is_live': True,
'age_limit': 18,
'formats': formats,
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/cammodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _real_extract(self, url):

return {
'id': user_id,
'title': self._live_title(user_id),
'title': user_id,
'is_live': True,
'formats': formats,
'age_limit': 18
Expand Down
2 changes: 0 additions & 2 deletions yt_dlp/extractor/ceskatelevize.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@ def _real_extract(self, url):

if playlist_len == 1:
final_title = playlist_title or title
if is_live:
final_title = self._live_title(final_title)
else:
final_title = '%s (%s)' % (playlist_title, title)

Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/chaturbate.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _real_extract(self, url):

return {
'id': video_id,
'title': self._live_title(video_id),
'title': video_id,
'thumbnail': 'https://roomimg.stream.highwebmedia.com/ri/%s.jpg' % video_id,
'age_limit': self._rta_search(webpage),
'is_live': True,
Expand Down
9 changes: 2 additions & 7 deletions yt_dlp/extractor/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import base64
import collections
import datetime
import hashlib
import itertools
import json
Expand Down Expand Up @@ -3512,12 +3511,8 @@ def _parse_jwplayer_formats(self, jwplayer_sources_data, video_id=None,
return formats

def _live_title(self, name):
""" Generate the title for a live video """
if name is None:
return None
now = datetime.datetime.now()
now_str = now.strftime('%Y-%m-%d %H:%M')
return name + ' ' + now_str
self._downloader.deprecation_warning('yt_dlp.InfoExtractor._live_title is deprecated and does not work as expected')
return name

def _int(self, v, name, fatal=False, **kwargs):
res = int_or_none(v, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/dailymotion.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def _real_extract(self, url):

return {
'id': video_id,
'title': self._live_title(title) if is_live else title,
'title': title,
'description': clean_html(media.get('description')),
'thumbnails': thumbnails,
'duration': int_or_none(metadata.get('duration')) or None,
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/dlive.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _real_extract(self, url):
self._sort_formats(formats)
return {
'id': display_name,
'title': self._live_title(title),
'title': title,
'uploader': display_name,
'uploader_id': username,
'formats': formats,
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/douyutv.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _real_extract(self, url):
'aid': 'pcclient'
})['data']['live_url']

title = self._live_title(unescapeHTML(room['room_name']))
title = unescapeHTML(room['room_name'])
description = room.get('show_details')
thumbnail = room.get('room_src')
uploader = room.get('nickname')
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/drtv.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def _real_extract(self, url):
channel_data = self._download_json(
'https://www.dr.dk/mu-online/api/1.0/channel/' + channel_id,
channel_id)
title = self._live_title(channel_data['Title'])
title = channel_data['Title']

formats = []
for streaming_server in channel_data.get('StreamingServers', []):
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/filmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _real_extract(self, url):
return {
'id': channel_id,
'display_id': channel_data.get('alias'),
'title': self._live_title(title) if is_live else title,
'title': title,
'description': channel_data.get('description'),
'thumbnails': thumbnails,
'formats': formats,
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/francetv.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def _extract_video(self, video_id, catalogue=None):

return {
'id': video_id,
'title': self._live_title(title) if is_live else title,
'title': title,
'thumbnail': image,
'duration': duration,
'timestamp': timestamp,
Expand Down
3 changes: 0 additions & 3 deletions yt_dlp/extractor/freshlive.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ def _real_extract(self, url):
stream_url, video_id, 'mp4',
'm3u8_native', m3u8_id='hls')

if is_live:
title = self._live_title(title)

return {
'id': video_id,
'formats': formats,
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/hitbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,6 @@ def _real_extract(self, url):
'https://www.smashcast.tv/api/media/live', video_id)
metadata['formats'] = formats
metadata['is_live'] = True
metadata['title'] = self._live_title(metadata.get('title'))
metadata['title'] = metadata.get('title')

return metadata
2 changes: 1 addition & 1 deletion yt_dlp/extractor/imggaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _real_extract(self, url):
video_data = self._download_json(dve_api_url, media_id)
is_live = media_type == 'live'
if is_live:
title = self._live_title(self._call_api('event/', media_id)['title'])
title = self._call_api('event/', media_id)['title']
else:
title = video_data['name']

Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/ivideon.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _real_extract(self, url):

return {
'id': server_id,
'title': self._live_title(camera_name or server_id),
'title': camera_name or server_id,
'description': description,
'is_live': True,
'formats': formats,
Expand Down
4 changes: 2 additions & 2 deletions yt_dlp/extractor/laola1tv.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def get_flashvar(x, *args, **kwargs):

return {
'id': video_id,
'title': self._live_title(title) if is_live else title,
'title': title,
'upload_date': unified_strdate(_v('time_date')),
'uploader': _v('meta_organisation'),
'categories': categories,
Expand Down Expand Up @@ -161,7 +161,7 @@ def _extract_video(self, url):
return {
'id': video_id,
'display_id': display_id,
'title': self._live_title(title) if is_live else title,
'title': title,
'description': video_data.get('description'),
'thumbnail': video_data.get('image'),
'categories': categories,
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _parse_broadcast_item(self, item):

return {
'id': broadcast_id,
'title': self._live_title(title) if is_live else title,
'title': title,
'thumbnails': thumbnails,
'timestamp': int_or_none(item.get('createdAt')),
'channel': channel.get('name'),
Expand Down
4 changes: 2 additions & 2 deletions yt_dlp/extractor/livestream.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def _extract_stream_info(self, stream_info):
return {
'id': broadcast_id,
'formats': formats,
'title': self._live_title(stream_info['stream_title']) if is_live else stream_info['stream_title'],
'title': stream_info['stream_title'],
'thumbnail': stream_info.get('thumbnail_url'),
'is_live': is_live,
}
Expand Down Expand Up @@ -344,7 +344,7 @@ def _real_extract(self, url):
is_live = video_data.get('isLive')
info.update({
'id': content_id,
'title': self._live_title(info['title']) if is_live else info['title'],
'title': info['title'],
'formats': self._extract_video_formats(video_data, content_id),
'is_live': is_live,
})
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/mangomolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _real_extract(self, url):

return {
'id': page_id,
'title': self._live_title(page_id) if self._IS_LIVE else page_id,
'title': page_id,
'uploader_id': hidden_inputs.get('userid'),
'duration': int_or_none(hidden_inputs.get('duration')),
'is_live': self._IS_LIVE,
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/matchtv.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _real_extract(self, url):
self._sort_formats(formats)
return {
'id': video_id,
'title': self._live_title('Матч ТВ - Прямой эфир'),
'title': 'Матч ТВ - Прямой эфир',
'is_live': True,
'formats': formats,
}
2 changes: 1 addition & 1 deletion yt_dlp/extractor/muenchentv.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _real_extract(self, url):
display_id = 'live'
webpage = self._download_webpage(url, display_id)

title = self._live_title(self._og_search_title(webpage))
title = self._og_search_title(webpage)

data_js = self._search_regex(
r'(?s)\nplaylist:\s*(\[.*?}\]),',
Expand Down
4 changes: 1 addition & 3 deletions yt_dlp/extractor/nbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def _real_extract(self, url):
self._sort_formats(formats)
return {
'id': video_id,
'title': self._live_title(title) if is_live else title,
'title': title,
'description': live_source.get('description'),
'formats': formats,
'is_live': is_live,
Expand Down Expand Up @@ -545,8 +545,6 @@ def _real_extract(self, url):

title = event_config['eventTitle']
is_live = {'live': True, 'replay': False}.get(event_config.get('eventStatus'))
if is_live:
title = self._live_title(title)

source_url = self._download_json(
f'https://api-leap.nbcsports.com/feeds/assets/{pid}?application=NBCOlympics&platform=desktop&format=nbc-player&env=staging',
Expand Down
2 changes: 0 additions & 2 deletions yt_dlp/extractor/ndr.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,6 @@ def _real_extract(self, url):

live = playlist.get('config', {}).get('streamType') in ['httpVideoLive', 'httpAudioLive']
title = config['title']
if live:
title = self._live_title(title)
uploader = ppjson.get('config', {}).get('branding')
upload_date = ppjson.get('config', {}).get('publicationDate')
duration = int_or_none(config.get('duration'))
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/nfl.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _parse_video_config(self, video_config, display_id):
'ext': determine_ext(image_url, 'jpg'),
}]
info.update({
'title': self._live_title(title) if is_live else title,
'title': title,
'is_live': is_live,
'description': clean_html(item.get('description')),
'thumbnails': thumbnails,
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/nova.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _real_extract(self, url):

player = self._parse_json(
self._search_regex(
(r'(?:replacePlaceholders.*?:\s*)?replacePlaceholders\s*\(\s*(?P<json>{.*})\s*\)(?:\s*\))?\s*,',
(r'(?:(?:replacePlaceholders|processAdTagModifier).*?:\s*)?(?:replacePlaceholders|processAdTagModifier)\s*\(\s*(?P<json>{.*?})\s*\)(?:\s*\))?\s*,',
r'Player\.init\s*\([^,]+,(?P<cndn>\s*\w+\s*\?)?\s*(?P<json>{(?(cndn).+?|.+)})\s*(?(cndn):|,\s*{.+?}\s*\)\s*;)'),
webpage, 'player', default='{}', group='json'), video_id, fatal=False)
if player:
Expand Down
4 changes: 2 additions & 2 deletions yt_dlp/extractor/npo.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def add_format_url(format_url):

return {
'id': video_id,
'title': self._live_title(title) if is_live else title,
'title': title,
'description': metadata.get('info'),
'thumbnail': metadata.get('images', [{'url': None}])[-1]['url'],
'upload_date': unified_strdate(metadata.get('gidsdatum')),
Expand Down Expand Up @@ -561,7 +561,7 @@ def _real_extract(self, url):
return {
'id': video_id,
'url': stream['url'],
'title': self._live_title(title),
'title': title,
'acodec': codec,
'ext': codec,
'is_live': True,
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/odnoklassniki.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def _extract_desktop(self, url):

assert title
if provider == 'LIVE_TV_APP':
info['title'] = self._live_title(title)
info['title'] = title

quality = qualities(('4', '0', '1', '2', '3', '5'))

Expand Down
4 changes: 2 additions & 2 deletions yt_dlp/extractor/oktoberfesttv.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)

title = self._live_title(self._html_search_regex(
r'<h1><strong>.*?</strong>(.*?)</h1>', webpage, 'title'))
title = self._html_search_regex(
r'<h1><strong>.*?</strong>(.*?)</h1>', webpage, 'title')

clip = self._search_regex(
r"clip:\s*\{\s*url:\s*'([^']+)'", webpage, 'clip')
Expand Down
2 changes: 1 addition & 1 deletion yt_dlp/extractor/picarto.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _real_extract(self, url):

return {
'id': channel_id,
'title': self._live_title(title.strip()),
'title': title.strip(),
'is_live': True,
'channel': channel_id,
'channel_id': metadata.get('id'),
Expand Down

0 comments on commit 706144f

Please sign in to comment.