mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-10-02 23:47:08 +02:00
Update rtp.py based on some comments in youtube-dl#29824
This commit is contained in:
parent
afa82654fa
commit
8e977a039e
@ -3,6 +3,7 @@
|
||||
ExtractorError,
|
||||
RegexNotFoundError,
|
||||
determine_ext,
|
||||
join_nonempty,
|
||||
js_to_json,
|
||||
)
|
||||
import re
|
||||
@ -102,7 +103,7 @@ def _real_extract(self, url):
|
||||
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title')
|
||||
title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title', default='')
|
||||
|
||||
# Raise error if episode is unavailable
|
||||
if 'Este episódio não se encontra disponível' in title:
|
||||
@ -111,10 +112,11 @@ def _real_extract(self, url):
|
||||
# Replace irrelevant string in title
|
||||
title = re.sub(r' - ?RTP Play - RTP', '', title)
|
||||
|
||||
# Check if it's a program split in parts, if so add part number to title
|
||||
# Check if it's a program split in parts
|
||||
part = self._html_search_regex(r'section\-parts.*<span.*>(.+?)</span>.*</ul>', webpage, 'part', default=None)
|
||||
if part is not None:
|
||||
title = '{title} {part}'.format(title=title, part=part)
|
||||
|
||||
# Add program part identification to title if it exists
|
||||
title = join_nonempty(title, part, delim=' ')
|
||||
|
||||
try:
|
||||
# Extract f and config from page
|
||||
|
Loading…
Reference in New Issue
Block a user