Code Monkey home page Code Monkey logo

Comments (14)

bensonz avatar bensonz commented on August 17, 2024

emm, get_note_by_id_from_html 这个可以用
但是之前那个咋突然没了呢?

from xhs.

glorysaladin avatar glorysaladin commented on August 17, 2024

get_note_by_id_from_html

get_note_by_id一样获取的是空的, 看之前的issue说是触发了小红书的验证码了,现在应该是没办法绕过去。

from xhs.

hjhjhghghg avatar hjhjhghghg commented on August 17, 2024

同上,这两天get_note_by_id时好时坏,但是from_html是好的

from xhs.

Gh-mean avatar Gh-mean commented on August 17, 2024

经过测试,目前所有note和user的请求均461,返回头中包含验证码uuid。使用该id请求验证码滑过后再请求依旧461

from xhs.

bensonz avatar bensonz commented on August 17, 2024

opps 刚看到, 前面有 issue 提过了. Author 建议多试几次.
现在看来这个验证码 uuid 是绕不过去了.

from xhs.

glorysaladin avatar glorysaladin commented on August 17, 2024

from html 获取到的图片不清晰

from xhs.

bensonz avatar bensonz commented on August 17, 2024

妈的我怀疑这里被小红书监控了, 昨天 get by html 还行, 今天就 json 解析失败.

from xhs.

bensonz avatar bensonz commented on August 17, 2024

有没有什么微信群, 可以一起看看什么情况
@ReaJason

from xhs.

ReaJason avatar ReaJason commented on August 17, 2024

这么恐怖嘛

from xhs.

ReaJason avatar ReaJason commented on August 17, 2024

更新了 0.2.12 版本,先尝试用 get_note_by_id_from_html 替代吧,目前没时间研究验证码, 如果有好的思路欢迎在 #109 讨论

from xhs.

bensonz avatar bensonz commented on August 17, 2024

很神奇, 如果把 chromise 的 headless = False, 就可以了.

browser = chromium.launch(headless=False)

一旦设置成 true, 就会 redirect 到 website-login/captcha
回头再看看有没有什么解决方案, 不应该啊.

from xhs.

Gh-mean avatar Gh-mean commented on August 17, 2024

很神奇, 如果把 chromise 的 headless = False, 就可以了.

browser = chromium.launch(headless=False)

一旦设置成 true, 就会 redirect 到 website-login/captcha 回头再看看有没有什么解决方案, 不应该啊.

maybe无头模式被检测了?

from xhs.

ReaJason avatar ReaJason commented on August 17, 2024

from html 获取到的图片不清晰

直接通过 xhs.help.get_imgs_url_from_note(note) 把获取到的笔记传进去应该是无水印的图片了

from xhs.

hjhjhghghg avatar hjhjhghghg commented on August 17, 2024

from html 获取到的图片不清晰

直接通过 xhs.help.get_imgs_url_from_note(note) 把获取到的笔记传进去应该是无水印的图片了

这个接口好像也有问题了
我的代码:#根据笔记id下载素材
@app.route("/save_files_from_note_id", methods=["GET"])
def save_files_from_note_id():
noteid = request.args.get('noteid')
file_dir = r"C:\Users\az\Pictures\xhs_samples"
if not noteid:
return "noteid is required", 400
id = request.args.get('id')
if not id:
return jsonify({"error": "account_id is required"}), 400

# 从数据库中查找匹配的账户记录
account = Account.query.filter_by(id=id).first()
if account:
    xhs_client = XhsClient(account.cookie, sign=sign)  # 自定义代理
    save_res = xhs_client.save_files_from_note_id(noteid,file_dir)
return save_res

返回:
[2024-04-30 04:35:50,415] ERROR in app: Exception on /save_files_from_note_id [GET]
Traceback (most recent call last):
File "C:\Users\az\PycharmProjects\xhs\venv\lib\site-packages\flask\app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\az\PycharmProjects\xhs\venv\lib\site-packages\flask\app.py", line 883, in full_dispatch_request
return self.finalize_request(rv)
File "C:\Users\az\PycharmProjects\xhs\venv\lib\site-packages\flask\app.py", line 902, in finalize_request
response = self.make_response(rv)
File "C:\Users\az\PycharmProjects\xhs\venv\lib\site-packages\flask\app.py", line 1174, in make_response
raise TypeError(
TypeError: The view function for 'save_files_from_note_id' did not return a valid response. The function either returned None or ended without a return statement.
我在help的方法中打印了一下:
def get_imgs_url_from_note(note) -> list:
"""the return type is [img1_url, img2_url, ...]"""
imgs = note["image_list"]
if not len(imgs):
return []
img_urls = [get_img_url_by_trace_id(get_trace_id(img["info_list"][0]["url"])) for img in imgs]
print("图片地址:"+img_urls)
return img_urls
图片地址:https://sns-img-hw.xhscdn.com/1040g0083124l719t426g5petcreh92d6dgrdrd0?imageView2/format/png
None
是不是因为这个None导致的问题
我还打印了note:
{'cursor_score': '', 'items': [{'id': '662e0c16000000000103126f', 'model_type': 'note', 'note_card': {'type': 'normal', 'last_update_time': 1714293783000, 'share_info': {'un_share': False}, 'illegal_info': {'desc': '请谨慎甄别内容信息,注意个人安全', 'left_icon': 'https://picasso-static.xiaohongshu.com/fe-platfrom/bc740cc162107169b504c4c1e5ee35f92eaa8456.png'}, 'title': '福州五一搭子集合 限女', 'tag_list': [{'id': '653335510000000003012030', 'name': '福州女生搭子', 'type': 'topic'}, {'type': 'topic', 'id': '64110ed3000000001803812c', 'name': '求女生搭子'}, {'id': '645c9ae9000000001a00578d', 'name': '找女生搭子', 'type': 'topic'}, {'name': '女生饭搭子', 'type': 'topic', 'id': '64afa1a6000000002502396c'}, {'id': '6428096b000000000901b7e1', 'name': '女生找搭子', 'type': 'topic'}, {'type': 'topic', 'id': '62c3d9df00000000010054d2', 'name': '聊天搭子'}, {'id': '6246a703000000000101f676', 'name': '找饭搭子', 'type': 'topic'}, {'id': '5c5f671b000000000d0299e5', 'name': '一起玩', 'type': 'topic'}, {'name': '约饭', 'type': 'topic', 'id': '5cb9b7fc000000000f03a388'}, {'id': '5eb7ead70000000001007241', 'name': '组局', 'type': 'topic'}, {'id': '64140026000000000901b34d', 'name': '女生搭子', 'type': 'topic'}], 'at_user_list': [], 'note_id': '662e0c16000000000103126f', 'desc': ' ', 'user': {'user_id': '65dd66dd00000000050089a6', 'nickname': '福州-惊喜搭子', 'avatar': 'https://sns-avatar-qc.xhscdn.com/avatar/1040g2jo3124k7g3v3s5g5petcreh92d6fd0id0g'}, 'time': 1714293782000, 'ip_location': '福建', 'interact_info': {'share_count': '0', 'followed': False, 'relation': 'none', 'liked': False, 'liked_count': '5', 'collected': False, 'collected_count': '0', 'comment_count': '1'}, 'image_list': [{'info_list': [{'image_scene': 'CRD_WM_WEBP', 'url': 'http://sns-webpic-qc.xhscdn.com/202404300435/0727640d018a034bcee4408eba1e487b/1040g0083124l719t426g5petcreh92d6dgrdrd0!nd_whgt34_webp_wm_1'}], 'file_id': '', 'height': 2560, 'width': 1920, 'url': '', 'trace_id': ''}]}}], 'current_time': 1714422950766}

from xhs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.