This commit is contained in:
g1879 2023-03-03 20:11:28 +08:00
parent 9ce271561f
commit 55e6d2dbd5
3 changed files with 5 additions and 7 deletions

View File

@ -828,13 +828,11 @@ class Screencast(object):
self.set(save_path, quality)
if self._path is None:
raise ValueError('save_path必须设置。')
if not self._path.isascii():
raise TypeError('仅支持英文路径。')
clean_folder(self._path)
self._page.driver.Page.screencastFrame = self._onScreencastFrame
self._page.run_cdp('Page.startScreencast', everyNthFrame=1, quality=self._quality)
def stop(self, to_mp4=True, video_name=None):
def stop(self, to_mp4=False, video_name=None):
"""停止录屏
:param to_mp4: 是否合并成MP4格式
:param video_name: 视频文件名为None时以当前时间名命
@ -845,8 +843,8 @@ class Screencast(object):
if not to_mp4:
return str(Path(self._path).absolute())
if not str(video_name).isascii():
raise TypeError('仅支持英文文件名。')
if not str(video_name).isascii() or not str(self._path).isascii():
raise TypeError('转换成视频仅支持英文路径和文件名。')
try:
from cv2 import VideoWriter, imread

View File

@ -205,7 +205,7 @@ class Screencast(object):
def start(self, save_path: Union[str, Path] = None, quality: int = None) -> None: ...
def stop(self, to_mp4: bool = True, video_name: str = None) -> str: ...
def stop(self, to_mp4: bool = False, video_name: str = None) -> str: ...
def set(self, save_path: Union[str, Path] = None, quality: int = None) -> None: ...

View File

@ -6,7 +6,7 @@ with open("README.md", "r", encoding='utf-8') as fh:
setup(
name="DrissionPage",
version="3.2.8",
version="3.2.9",
author="g1879",
author_email="g1879@qq.com",
description="Python based web automation tool. It can control the browser and send and receive data packets.",