mirror of
https://github.com/JoeanAmier/XHS-Downloader.git
synced 2026-03-22 06:57:16 +08:00
feat: 支持按作者归档保存作品文件
BREAKING CHANGE: 新增配置文件参数:account_archive Closes #226 Closes #229
This commit is contained in:
52
example.py
52
example.py
@@ -28,30 +28,32 @@ async def example():
|
||||
live_download = False # 图文动图文件下载开关
|
||||
download_record = True # 是否记录下载成功的作品 ID
|
||||
language = "zh_CN" # 设置程序提示语言
|
||||
account_archive = True # 是否将每个作者的作品存至单独的文件夹
|
||||
read_cookie = None # 读取浏览器 Cookie,支持设置浏览器名称(字符串)或者浏览器序号(整数),设置为 None 代表不读取
|
||||
|
||||
# async with XHS() as xhs:
|
||||
# pass # 使用默认参数
|
||||
|
||||
async with XHS(
|
||||
work_path=work_path,
|
||||
folder_name=folder_name,
|
||||
name_format=name_format,
|
||||
user_agent=user_agent,
|
||||
cookie=cookie,
|
||||
proxy=proxy,
|
||||
timeout=timeout,
|
||||
chunk=chunk,
|
||||
max_retry=max_retry,
|
||||
record_data=record_data,
|
||||
image_format=image_format,
|
||||
folder_mode=folder_mode,
|
||||
image_download=image_download,
|
||||
video_download=video_download,
|
||||
live_download=live_download,
|
||||
download_record=download_record,
|
||||
language=language,
|
||||
read_cookie=read_cookie,
|
||||
work_path=work_path,
|
||||
folder_name=folder_name,
|
||||
name_format=name_format,
|
||||
user_agent=user_agent,
|
||||
cookie=cookie,
|
||||
proxy=proxy,
|
||||
timeout=timeout,
|
||||
chunk=chunk,
|
||||
max_retry=max_retry,
|
||||
record_data=record_data,
|
||||
image_format=image_format,
|
||||
folder_mode=folder_mode,
|
||||
image_download=image_download,
|
||||
video_download=video_download,
|
||||
live_download=live_download,
|
||||
download_record=download_record,
|
||||
language=language,
|
||||
read_cookie=read_cookie,
|
||||
account_archive=account_archive,
|
||||
) as xhs: # 使用自定义参数
|
||||
download = True # 是否下载作品文件,默认值:False
|
||||
# 返回作品详细信息,包括下载地址
|
||||
@@ -62,13 +64,13 @@ async def example():
|
||||
async def test():
|
||||
url = ""
|
||||
async with XHS(
|
||||
download_record=False,
|
||||
# image_format="PNG",
|
||||
# image_format="WEBP",
|
||||
# image_format="JPEG",
|
||||
# image_format="HEIC",
|
||||
# image_format="AVIF",
|
||||
# image_format="AUTO",
|
||||
download_record=False,
|
||||
# image_format="PNG",
|
||||
# image_format="WEBP",
|
||||
# image_format="JPEG",
|
||||
# image_format="HEIC",
|
||||
# image_format="AVIF",
|
||||
# image_format="AUTO",
|
||||
) as xhs:
|
||||
print(
|
||||
await xhs.extract(
|
||||
|
||||
Reference in New Issue
Block a user