mirror of
https://github.com/JoeanAmier/XHS-Downloader.git
synced 2025-12-26 04:48:05 +08:00
更新代码
This commit is contained in:
parent
b7bb3ca05c
commit
0af49ceede
3
main.py
3
main.py
@ -6,8 +6,7 @@ def example():
|
||||
image_demo = "https://www.xiaohongshu.com/explore/64d1b406000000000103ee8d"
|
||||
video_demo = "https://www.xiaohongshu.com/explore/64c05652000000000c0378e7"
|
||||
xhs = XHS()
|
||||
# print(xhs.get_image(image_demo))
|
||||
# print(xhs.get_video(video_demo))
|
||||
print(xhs.extract(image_demo))
|
||||
print(xhs.extract(video_demo))
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
from datetime import datetime
|
||||
from json import loads
|
||||
from re import compile
|
||||
from time import strftime
|
||||
|
||||
|
||||
class Explore:
|
||||
@ -46,9 +46,12 @@ class Explore:
|
||||
container["作品类型"] = {"video": "视频", "normal": "图文"}[data["type"]]
|
||||
|
||||
def __extract_time(self, container: dict, data: dict):
|
||||
container["发布时间"] = strftime(self.time_format, data["time"])
|
||||
container["最后更新时间"] = strftime(
|
||||
self.time_format, data["lastUpdateTime"])
|
||||
container["发布时间"] = datetime.fromtimestamp(
|
||||
data["time"] / 1000).strftime(self.time_format)
|
||||
container["最后更新时间"] = datetime.fromtimestamp(
|
||||
data["lastUpdateTime"] /
|
||||
1000).strftime(
|
||||
self.time_format)
|
||||
|
||||
@staticmethod
|
||||
def __extract_user(container: dict, data: dict):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user