[downloader/f4m] More accurate fragment URL construction

This commit is contained in:
Sergey M․ 2015-10-24 21:02:31 +06:00
parent 324ac0a243
commit 8cd9614abf

View File

@ -340,11 +340,14 @@ class F4mFD(FragmentFD):
while fragments_list: while fragments_list:
seg_i, frag_i = fragments_list.pop(0) seg_i, frag_i = fragments_list.pop(0)
name = 'Seg%d-Frag%d' % (seg_i, frag_i) name = 'Seg%d-Frag%d' % (seg_i, frag_i)
url_parsed = base_url_parsed._replace(path=base_url_parsed.path + name) query = []
if base_url_parsed.query:
query.append(base_url_parsed.query)
if akamai_pv: if akamai_pv:
url_parsed = url_parsed._replace(query=url_parsed.query + akamai_pv.strip(';')) query.append(akamai_pv.strip(';'))
if info_dict.get('extra_param_to_segment_url'): if info_dict.get('extra_param_to_segment_url'):
url_parsed = url_parsed._replace(query=url_parsed.query + info_dict.get('extra_param_to_segment_url')) query.append(info_dict['extra_param_to_segment_url'])
url_parsed = base_url_parsed._replace(path=base_url_parsed.path + name, query='&'.join(query))
frag_filename = '%s-%s' % (ctx['tmpfilename'], name) frag_filename = '%s-%s' % (ctx['tmpfilename'], name)
try: try:
success = ctx['dl'].download(frag_filename, {'url': url_parsed.geturl()}) success = ctx['dl'].download(frag_filename, {'url': url_parsed.geturl()})