mirror of
https://github.com/JoeanAmier/XHS-Downloader.git
synced 2025-12-26 04:48:05 +08:00
feat: 支持音乐图集作品下载
This commit is contained in:
parent
a8669caeb9
commit
92dd28c815
@ -315,9 +315,13 @@ class XHS:
|
||||
return {}
|
||||
if data["作品类型"] == _("视频"):
|
||||
self.__extract_video(data, namespace)
|
||||
elif data["作品类型"] == _("图文"):
|
||||
elif data["作品类型"] in {
|
||||
_("图文"),
|
||||
_("图集"),
|
||||
}:
|
||||
self.__extract_image(data, namespace)
|
||||
else:
|
||||
logging(log, _("未知的作品类型:{0}").format(i), WARNING)
|
||||
data["下载地址"] = []
|
||||
await self.update_author_nickname(data, log)
|
||||
await self.__download_files(data, download, index, log, bar)
|
||||
|
||||
@ -9,9 +9,6 @@ __all__ = ["Explore"]
|
||||
class Explore:
|
||||
time_format = "%Y-%m-%d_%H:%M:%S"
|
||||
|
||||
def __init__(self):
|
||||
self.explore_type = {"video": _("视频"), "normal": _("图文")}
|
||||
|
||||
def run(self, data: Namespace) -> dict:
|
||||
return self.__extract_data(data)
|
||||
|
||||
@ -46,9 +43,7 @@ class Explore:
|
||||
)
|
||||
container["作品标题"] = data.safe_extract("title")
|
||||
container["作品描述"] = data.safe_extract("desc")
|
||||
container["作品类型"] = self.explore_type.get(
|
||||
data.safe_extract("type"), _("未知")
|
||||
)
|
||||
container["作品类型"] = self.__classify_works(data)
|
||||
# container["IP归属地"] = data.safe_extract("ipLocation")
|
||||
|
||||
def __extract_time(self, container: dict, data: Namespace):
|
||||
@ -73,3 +68,13 @@ class Explore:
|
||||
container["作者链接"] = (
|
||||
f"https://www.xiaohongshu.com/user/profile/{container['作者ID']}"
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def __classify_works(data: Namespace) -> str:
|
||||
type_ = data.safe_extract("type")
|
||||
list_ = data.safe_extract("imageList", [])
|
||||
if type_ not in {"video", "normal"} or len(list_) == 0:
|
||||
return _("未知")
|
||||
if type_ == "video":
|
||||
return _("视频") if len(list_) == 1 else _("图集")
|
||||
return _("图文")
|
||||
|
||||
@ -7,7 +7,7 @@ __all__ = ["Image"]
|
||||
|
||||
class Image:
|
||||
@classmethod
|
||||
def get_image_link(cls, data: Namespace, format_: str) -> [list, list]:
|
||||
def get_image_link(cls, data: Namespace, format_: str) -> tuple[list, list]:
|
||||
images = data.safe_extract("imageList", [])
|
||||
live_link = cls.__get_live_link(images)
|
||||
token_list = [
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
from pathlib import Path
|
||||
|
||||
VERSION_MAJOR = 2
|
||||
VERSION_MINOR = 5
|
||||
VERSION_BETA = False
|
||||
VERSION_MINOR = 6
|
||||
VERSION_BETA = True
|
||||
__VERSION__ = f"{VERSION_MAJOR}.{VERSION_MINOR}.{'beta' if VERSION_BETA else 'stable'}"
|
||||
ROOT = Path(__file__).resolve().parent.parent.parent
|
||||
PROJECT = f"XHS-Downloader V{VERSION_MAJOR}.{VERSION_MINOR} {
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
**项目更新内容:**
|
||||
|
||||
1. 支持音乐图集作品下载
|
||||
|
||||
*****
|
||||
|
||||
**用户脚本更新内容:**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user