diff options
author | Sergey M․ <dstftw@gmail.com> | 2015-11-06 23:45:26 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2015-11-06 23:45:26 +0600 |
commit | 0fa6b17dccd2347cb0611651fc04e36839d33a4e (patch) | |
tree | fafca838a61a7f10a04e3e43959b0a5e4514d5d5 /youtube_dl/extractor/pbs.py | |
parent | 472404953a22811cc8156da110ea872a924f1f18 (diff) |
[pbs] Simplify and speed up player URL search
Diffstat (limited to 'youtube_dl/extractor/pbs.py')
-rw-r--r-- | youtube_dl/extractor/pbs.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/youtube_dl/extractor/pbs.py b/youtube_dl/extractor/pbs.py index 3448736a2..7b868d057 100644 --- a/youtube_dl/extractor/pbs.py +++ b/youtube_dl/extractor/pbs.py @@ -191,9 +191,13 @@ class PBSIE(InfoExtractor): if media_id: return media_id, presumptive_id, upload_date - url = self._search_regex( - r'(?s)<iframe[^>]+?(?:[a-z-]+?=["\'].*?["\'][^>]+?)*?\bsrc=["\']([^\'"]+partnerplayer[^\'"]+)["\']', - webpage, 'player URL') + for iframe in re.findall(r'(?s)<iframe(.+?)></iframe>', webpage): + url = self._search_regex( + r'src=(["\'])(?P<url>.+?partnerplayer.+?)\1', iframe, + 'player URL', default=None, group='url') + if url: + break + mobj = re.match(self._VALID_URL, url) player_id = mobj.group('player_id') |