mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
改进下载功能,待测试
This commit is contained in:
parent
28b81f7be2
commit
1638a0f90f
@ -439,11 +439,11 @@ class ChromiumDownloadSetter(DownloadSetter):
|
||||
|
||||
def _download_by_DownloadKit(self, **kwargs):
|
||||
"""拦截浏览器下载并用downloadKit下载"""
|
||||
self._page.run_cdp('Browser.cancelDownload', guid=kwargs['guid'], not_change=True)
|
||||
self._page.download.add(kwargs['url'], self._page.download_path, kwargs['suggestedFilename'])
|
||||
if self._download_th is None or not self._download_th.is_alive():
|
||||
self._download_th = Thread(target=self._wait_download_complete, daemon=False)
|
||||
self._download_th.start()
|
||||
self._page.download.add(kwargs['url'], self._page.download_path, kwargs['suggestedFilename'])
|
||||
self._page.run_cdp('Browser.cancelDownload', guid=kwargs['guid'], not_change=True)
|
||||
print(f'下载:{kwargs["url"]}')
|
||||
|
||||
def _wait_download_complete(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user