mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-26 20:22:14 +00:00
Remove afspelen and trailing slashes with one regex
Co-authored-by: dirkf <fieldhouse@gmx.net>
This commit is contained in:
parent
4c90b2f587
commit
007bbeacd7
1 changed files with 2 additions and 8 deletions
|
@ -44,14 +44,8 @@ class NPOIE(InfoExtractor):
|
|||
note='Downloading token')['token']
|
||||
|
||||
def _real_extract(self, url):
|
||||
# You might want to use removesuffix here,
|
||||
# but removesuffix is introduced in Python 3.9
|
||||
# and youtube-dl supports Python 3.2+
|
||||
if url.endswith('/afspelen'):
|
||||
url = url[:-9]
|
||||
elif url.endswith('/afspelen/'):
|
||||
url = url[:-10]
|
||||
url = url.rstrip('/')
|
||||
# Remove /afspelen and/or any trailing `/`s
|
||||
url = re.sub(r'/(?:afspelen)?/*$', '', url)
|
||||
slug = url.split('/')[-1]
|
||||
|
||||
program_metadata = self._download_json('https://npo.nl/start/api/domain/program-detail',
|
||||
|
|
Loading…
Reference in a new issue