1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-13 05:27:17 +08:00

[PBS] Fix AttributeError: 'NoneType'

This is a fix for #15373
This commit is contained in:
Urgau 2018-06-03 10:48:24 +02:00 committed by GitHub
parent 0a10f50e2f
commit f051742c3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -456,6 +456,8 @@ class PBSIE(InfoExtractor):
if not url:
url = self._og_search_url(webpage)
if url.strip().startswith("//"):
url = "https:" + url.strip()
mobj = re.match(self._VALID_URL, url)
player_id = mobj.group('player_id')
@ -465,8 +467,13 @@ class PBSIE(InfoExtractor):
player_page = self._download_webpage(
url, display_id, note='Downloading player page',
errnote='Could not download player page')
try:
video_id = self._search_regex(
r'<div\s+id="video_([0-9]+)"', player_page, 'video ID')
except:
video_id = self._search_regex(
r'"id":[\s]*"([0-9]+)"', player_page, 'video ID')
else:
video_id = mobj.group('id')
display_id = video_id