diff --git a/brozzler/ydl.py b/brozzler/ydl.py index af4cfe4..e2e995b 100644 --- a/brozzler/ydl.py +++ b/brozzler/ydl.py @@ -180,16 +180,16 @@ def _build_youtube_dl(worker, destdir, site): }) def process_info(self, info_dict): - _orig__finish_frag_download = youtube_dl.downloader.fragment.FragmentFD._finish_frag_download - - def _finish_frag_download(ffd_self, ctx): - _orig__finish_frag_download(ffd_self, ctx) - if worker._using_warcprox(site): - self._push_stitched_up_vid_to_warcprox(site, info_dict, ctx) - # lock this section to prevent race condition between threads that # want to monkey patch _finish_frag_download() at the same time with global_ydl_lock: + _orig__finish_frag_download = youtube_dl.downloader.fragment.FragmentFD._finish_frag_download + + def _finish_frag_download(ffd_self, ctx): + _orig__finish_frag_download(ffd_self, ctx) + if worker._using_warcprox(site): + self._push_stitched_up_vid_to_warcprox(site, info_dict, ctx) + try: youtube_dl.downloader.fragment.FragmentFD._finish_frag_download = _finish_frag_download return super().process_info(info_dict) diff --git a/setup.py b/setup.py index 430cb7e..bb405cd 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ def find_package_data(package): setuptools.setup( name='brozzler', - version='1.5.dev307', + version='1.5.dev308', description='Distributed web crawling with browsers', url='https://github.com/internetarchive/brozzler', author='Noah Levitt',