+ def _download_fragment(self, ctx, frag_url, info_dict, headers=None):
+ down = io.BytesIO()
+ success = ctx['dl'].download(down, {
+ 'url': frag_url,
+ 'http_headers': headers or info_dict.get('http_headers'),
+ })
+ if not success:
+ return False, None
+ frag_content = down.getvalue()
+ down.close()
+ return True, frag_content
+
+ def _append_fragment(self, ctx, frag_content):
+ ctx['dest_stream'].write(frag_content)
+ if not (ctx.get('live') or ctx['tmpfilename'] == '-'):
+ frag_index_stream, _ = sanitize_open(ctx['tmpfilename'] + '.fragindex', 'w')
+ frag_index_stream.write(compat_str(ctx['frag_index']))
+ frag_index_stream.close()
+