1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-09-15 23:32:25 +02:00

[pbs] Clean up title construction rationale

This commit is contained in:
Sergey M․ 2015-07-22 23:49:08 +06:00
parent 9872e588c8
commit ce1bafdce9

View File

@ -247,8 +247,8 @@ def _real_extract(self, url):
'url': closed_captions_url, 'url': closed_captions_url,
}] }]
# video.pbs.org video.pbs.org/videoInfo/... frequently provides an obscure 'title' value, like # info['title'] is often incomplete (e.g. 'Full Episode', 'Episode 5', etc)
# 'Full Episode', 'Episode 5', etc. prepend program->title # Try turning it to 'program - title' naming scheme if possible
alt_title = info.get('program', {}).get('title') alt_title = info.get('program', {}).get('title')
if alt_title: if alt_title:
info['title'] = alt_title + ' - ' + re.sub(r'^' + alt_title + '[\s\-\:]+', '', info['title']) info['title'] = alt_title + ' - ' + re.sub(r'^' + alt_title + '[\s\-\:]+', '', info['title'])