This commit is contained in:
Barbara Miller 2023-09-07 12:39:43 -07:00
parent 9cf12039c9
commit f868ce146b

View file

@ -1,7 +1,7 @@
''' '''
brozzler/ydl.py - youtube-dl / yt-dlp support for brozzler brozzler/ydl.py - youtube-dl / yt-dlp support for brozzler
Copyright (C) 2022 Internet Archive Copyright (C) 2023 Internet Archive
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -171,7 +171,7 @@ def _build_youtube_dl(worker, destdir, site, page):
self.logger.warning( self.logger.warning(
'guessing mimetype %s because %r', mimetype, e) 'guessing mimetype %s because %r', mimetype, e)
# watch page postprocessor is MoveFiles # youtube watch page postprocessor is MoveFiles
if postprocessor == 'FixupM3u8': if postprocessor == 'FixupM3u8':
url = 'youtube-dl:%05d:%s' % ( url = 'youtube-dl:%05d:%s' % (
info_dict.get('playlist_index') or 1, info_dict.get('playlist_index') or 1,
@ -220,8 +220,6 @@ def _build_youtube_dl(worker, destdir, site, page):
if d['status'] == 'finished': if d['status'] == 'finished':
worker.logger.info('[ydl_postprocess_hook] Finished postprocessing') worker.logger.info('[ydl_postprocess_hook] Finished postprocessing')
worker.logger.info('[ydl_postprocess_hook] postprocessor: {}'.format(d['postprocessor'])) worker.logger.info('[ydl_postprocess_hook] postprocessor: {}'.format(d['postprocessor']))
#worker.logger.info('[ydl_postprocess_hook] passed params: {}'.format(d))
# if d['postprocessor'] == 'FixupM3u8' and worker._using_warcprox(site):
if worker._using_warcprox(site): if worker._using_warcprox(site):
_YoutubeDL._push_stitched_up_vid_to_warcprox(_YoutubeDL, site, d['info_dict'], d['postprocessor']) _YoutubeDL._push_stitched_up_vid_to_warcprox(_YoutubeDL, site, d['info_dict'], d['postprocessor'])
@ -263,8 +261,11 @@ def _build_youtube_dl(worker, destdir, site, page):
"verbose": True, "verbose": True,
"quiet": False, "quiet": False,
} }
#if worker._proxy_for(site):
# skip proxying yt-dlp v.2023.07.06
# if worker._proxy_for(site):
# ydl_opts["proxy"] = "http://{}".format(worker._proxy_for(site)) # ydl_opts["proxy"] = "http://{}".format(worker._proxy_for(site))
ydl = _YoutubeDL(ydl_opts) ydl = _YoutubeDL(ydl_opts)
if site.extra_headers(): if site.extra_headers():
ydl._opener.add_handler(ExtraHeaderAdder(site.extra_headers(page))) ydl._opener.add_handler(ExtraHeaderAdder(site.extra_headers(page)))