mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-13 16:57:28 +00:00
[downloader/f4m] If <pv-2.0> is in the manifest, add it to the fragments urls query (fixes #3176)
It's used in some akamai videos (for example for theplatform.com).
This commit is contained in:
parent
b28c8403b2
commit
b509a4b176
@ -16,6 +16,7 @@ from ..utils import (
|
|||||||
format_bytes,
|
format_bytes,
|
||||||
encodeFilename,
|
encodeFilename,
|
||||||
sanitize_open,
|
sanitize_open,
|
||||||
|
xpath_text,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -251,6 +252,8 @@ class F4mFD(FileDownloader):
|
|||||||
# We only download the first fragment
|
# We only download the first fragment
|
||||||
fragments_list = fragments_list[:1]
|
fragments_list = fragments_list[:1]
|
||||||
total_frags = len(fragments_list)
|
total_frags = len(fragments_list)
|
||||||
|
# For some akamai manifests we'll need to add a query to the fragment url
|
||||||
|
akamai_pv = xpath_text(doc, _add_ns('pv-2.0'))
|
||||||
|
|
||||||
tmpfilename = self.temp_name(filename)
|
tmpfilename = self.temp_name(filename)
|
||||||
(dest_stream, tmpfilename) = sanitize_open(tmpfilename, 'wb')
|
(dest_stream, tmpfilename) = sanitize_open(tmpfilename, 'wb')
|
||||||
@ -290,6 +293,8 @@ class F4mFD(FileDownloader):
|
|||||||
for (seg_i, frag_i) in fragments_list:
|
for (seg_i, frag_i) in fragments_list:
|
||||||
name = 'Seg%d-Frag%d' % (seg_i, frag_i)
|
name = 'Seg%d-Frag%d' % (seg_i, frag_i)
|
||||||
url = base_url + name
|
url = base_url + name
|
||||||
|
if akamai_pv:
|
||||||
|
url += '?' + akamai_pv.strip(';')
|
||||||
frag_filename = '%s-%s' % (tmpfilename, name)
|
frag_filename = '%s-%s' % (tmpfilename, name)
|
||||||
success = http_dl.download(frag_filename, {'url': url})
|
success = http_dl.download(frag_filename, {'url': url})
|
||||||
if not success:
|
if not success:
|
||||||
|
Loading…
Reference in New Issue
Block a user