diff --git a/CHANGELOG.md b/CHANGELOG.md index 25e3bcc..fe0c490 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ - Improve documentation - Add more test function +## 0.2.11 + +### Fixed + +- fix image and video post error + ## 0.2.10 ### Added diff --git a/xhs/__version__.py b/xhs/__version__.py index 1db14e6..3f4924b 100644 --- a/xhs/__version__.py +++ b/xhs/__version__.py @@ -8,8 +8,8 @@ __title__ = "xhs" __description__ = "xiaohongshu crawl sdk." __url__ = "https://github.com/ReaJason/xhs" -__version__ = "0.2.10" -__build__ = 0x000210 +__version__ = "0.2.11" +__build__ = 0x000211 __author__ = "ReaJason" __author_email__ = "reajason1225@gmail.com" __license__ = "MIT" diff --git a/xhs/core.py b/xhs/core.py index 75a3c13..6049049 100644 --- a/xhs/core.py +++ b/xhs/core.py @@ -238,7 +238,7 @@ def transform_json_keys(json_data): return dict_new url = "https://www.xiaohongshu.com/explore/" + note_id - res = self.session.get(url, headers={"user-agent": self.user_agent}) + res = self.session.get(url, headers={"user-agent": self.user_agent, "referer": "https://www.xiaohongshu.com/"}) html = res.text state = re.findall(r"window.__INITIAL_STATE__=({.*})", html)[ 0 @@ -884,8 +884,7 @@ def create_note(self, title, desc, note_type, ats: list = None, topics: list = N headers = { "Referer": "https://creator.xiaohongshu.com/" } - print(data) - return self.post(uri, data, headers=headers, is_creator=True) + return self.post(uri, data, headers=headers) def create_image_note( self, @@ -945,7 +944,6 @@ def get_video_first_frame_image_id(self, video_id: str): ) res = response.json() - print(res) if res["data"]["hasFirstFrame"]: image_id = res["data"]["firstFrameFileId"] return image_id