ReaJason / xhs

基于小红书 Web 端进行的请求封装。https://reajason.github.io/xhs/
MIT License
946 stars 279 forks source link

图文话题 上传失败 #82

Closed SarcomTDG closed 5 months ago

SarcomTDG commented 6 months ago

话题上传返回了,但是xhs_client.create_video_note进行调用传话题返回的list,在小红书上面不显示

ReaJason commented 6 months ago

https://www.xiaohongshu.com/explore/65b8eef3000000002b03dceb

可以的呀,请问可以给一下报错信息不

CleanShot 2024-01-30 at 20 44 08@2x

SarcomTDG commented 5 months ago

没有报错,我这边的问题是:话题走xhs_client.get_suggest_topic上传没问题,然后走xhs_client.create_video_note里面topics携带,但是小红书上面没有显示话题 微信截图_20240131215529 微信截图_20240131215453 微信图片_20240131215714

ReaJason commented 5 months ago

请参考如下示例

def test_create_note_with_ats_topics(xhs_client: XhsClient):
    title = "我是通过自动发布脚本发送的笔记"
    desc = "deployed by GitHub xhs, #Python[话题]# @ReaJason"
    files = [
        "/Users/reajason/Downloads/wall/wallhaven-x6k21l.png",
    ]

    # 可以通过 xhs_client.get_suggest_ats(ats_keyword) 接口获取用户数据
    ats = [
        {"nickname": "ReaJason", "user_id": "63273a77000000002303cc9b", "name": "ReaJason"}
    ]

    # 可以通过 xhs_client.get_suggest_topic(topic_keyword) 接口获取标签数据
    topics = [
        {
            "id": "5d35dd9b000000000e0088dc", "name": "Python", "type": "topic",
            "link": "https://www.xiaohongshu.com/page/topics/5d35dd9ba059940001703e38?naviHidden=yes"
        }
    ]
    note = xhs_client.create_image_note(title, desc, files, ats=ats, topics=topics, is_private=True,
                                        post_time="2023-07-25 23:59:59")
    beauty_print(note)