Skip to content

Commit

Permalink
fix: create image note 404 (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReaJason committed Mar 14, 2024
1 parent 087861f commit 34a0ea3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
- Improve documentation
- Add more test function

## 0.2.11

### Fixed

- fix image and video post error

## 0.2.10

### Added
Expand Down
4 changes: 2 additions & 2 deletions xhs/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 2 additions & 4 deletions xhs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__=({.*})</script>", html)[
0
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 34a0ea3

Please sign in to comment.