mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-24 11:11:54 +00:00
[pbs] add test for videos with undocumented http formats and remove unused import
This commit is contained in:
parent
c366f8d30a
commit
f50365e91c
1 changed files with 16 additions and 3 deletions
|
@ -4,7 +4,6 @@ from __future__ import unicode_literals
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import compat_HTTPError
|
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
determine_ext,
|
determine_ext,
|
||||||
|
@ -334,6 +333,16 @@ class PBSIE(InfoExtractor):
|
||||||
'formats': 'mincount:8',
|
'formats': 'mincount:8',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
# has undocumented http formats(4500k and 6500k)
|
||||||
|
'url': 'http://www.pbs.org/video/2365815229/',
|
||||||
|
'md5': '94635cd06b7133688e23f4b94e6637a5',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '2365815229',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'FRONTLINE - Mosquito Hunter',
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'url': 'http://player.pbs.org/widget/partnerplayer/2365297708/?start=0&end=0&chapterbar=false&endscreen=false&topbar=true',
|
'url': 'http://player.pbs.org/widget/partnerplayer/2365297708/?start=0&end=0&chapterbar=false&endscreen=false&topbar=true',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
@ -501,14 +510,18 @@ class PBSIE(InfoExtractor):
|
||||||
if http_url:
|
if http_url:
|
||||||
for m3u8_format in m3u8_formats:
|
for m3u8_format in m3u8_formats:
|
||||||
bitrate = self._search_regex(r'(\d+)k', m3u8_format['url'], 'bitrate', default=None)
|
bitrate = self._search_regex(r'(\d+)k', m3u8_format['url'], 'bitrate', default=None)
|
||||||
# extract only the formats that we know that they will be available as http format.
|
# lower qualities(150k and 192k) are not available as http formats
|
||||||
|
# https://github.com/rg3/youtube-dl/commit/cbc032c8b70a038a69259378c92b4ba97b42d491#commitcomment-17313656
|
||||||
|
# we will try to extract any http format higher than than the lowest quality documented in
|
||||||
# https://projects.pbs.org/confluence/display/coveapi/COVE+Video+Specifications
|
# https://projects.pbs.org/confluence/display/coveapi/COVE+Video+Specifications
|
||||||
|
# as there also undocumented http formats formats(4500k and 6500k)
|
||||||
|
# http://www.pbs.org/video/2365815229/
|
||||||
if not bitrate or int(bitrate) < 400:
|
if not bitrate or int(bitrate) < 400:
|
||||||
continue
|
continue
|
||||||
f_url = re.sub(r'\d+k|baseline', bitrate + 'k', http_url)
|
f_url = re.sub(r'\d+k|baseline', bitrate + 'k', http_url)
|
||||||
# This may produce invalid links sometimes (e.g.
|
# This may produce invalid links sometimes (e.g.
|
||||||
# http://www.pbs.org/wgbh/frontline/film/suicide-plan)
|
# http://www.pbs.org/wgbh/frontline/film/suicide-plan)
|
||||||
if not self._is_valid_url(f_url, display_id, 'http-%s video' % bitrate):
|
if not self._is_valid_url(f_url, display_id, 'http-%sk video' % bitrate):
|
||||||
continue
|
continue
|
||||||
f = m3u8_format.copy()
|
f = m3u8_format.copy()
|
||||||
f.update({
|
f.update({
|
||||||
|
|
Loading…
Reference in a new issue