发布 1.7 版本

This commit is contained in:
JoeamAmier
2023-12-16 11:24:42 +08:00
parent 84a0889c8f
commit e0ba7af1f8
15 changed files with 487 additions and 346 deletions

19
main.py
View File

@@ -16,12 +16,15 @@ async def example():
folder_name = "Download" # 作品文件储存文件夹名称自动创建默认值Download
user_agent = "" # 请求头 User-Agent
cookie = "" # 小红书网页版 Cookie无需登录
proxy = "" # 网络代理
timeout = 5 # 网络请求超时限制单位默认值10
chunk = 1024 * 1024 # 下载文件时,每次从服务器获取的数据块大小,单位:字节
proxy = None # 网络代理
timeout = 5 # 请求数据超时限制单位默认值10
chunk = 1024 * 1024 * 10 # 下载文件时,每次从服务器获取的数据块大小,单位:字节
max_retry = 2 # 请求数据失败时重试的最大次数单位默认值5
# async with XHS() as xhs:
# pass # 使用默认参数
record_data = False # 是否记录作品数据至文件
image_format = "jpg" # 图文作品文件名称后缀
folder_mode = False # 是否将每个作品的文件储存至单独的文件夹
async with XHS() as xhs:
pass # 使用默认参数
async with XHS(path=path,
folder_name=folder_name,
user_agent=user_agent,
@@ -29,7 +32,11 @@ async def example():
proxy=proxy,
timeout=timeout,
chunk=chunk,
max_retry=max_retry, ) as xhs: # 使用自定义参数
max_retry=max_retry,
record_data=record_data,
image_format=image_format,
folder_mode=folder_mode,
) as xhs: # 使用自定义参数
download = True # 是否下载作品文件默认值False
# 返回作品详细信息,包括下载地址
print(await xhs.extract(error_demo, download)) # 获取数据失败时返回空字典