Comments (14)
emm, get_note_by_id_from_html
这个可以用
但是之前那个咋突然没了呢?
from xhs.
get_note_by_id_from_html
get_note_by_id一样获取的是空的, 看之前的issue说是触发了小红书的验证码了,现在应该是没办法绕过去。
from xhs.
同上,这两天get_note_by_id时好时坏,但是from_html是好的
from xhs.
经过测试,目前所有note和user的请求均461,返回头中包含验证码uuid。使用该id请求验证码滑过后再请求依旧461
from xhs.
opps 刚看到, 前面有 issue 提过了. Author 建议多试几次.
现在看来这个验证码 uuid 是绕不过去了.
from xhs.
from html 获取到的图片不清晰
from xhs.
妈的我怀疑这里被小红书监控了, 昨天 get by html 还行, 今天就 json 解析失败.
from xhs.
有没有什么微信群, 可以一起看看什么情况
@ReaJason
from xhs.
这么恐怖嘛
from xhs.
更新了 0.2.12 版本,先尝试用 get_note_by_id_from_html
替代吧,目前没时间研究验证码, 如果有好的思路欢迎在 #109 讨论
from xhs.
很神奇, 如果把 chromise 的 headless = False, 就可以了.
browser = chromium.launch(headless=False)
一旦设置成 true, 就会 redirect 到 website-login/captcha
回头再看看有没有什么解决方案, 不应该啊.
from xhs.
很神奇, 如果把 chromise 的 headless = False, 就可以了.
browser = chromium.launch(headless=False)
一旦设置成 true, 就会 redirect 到 website-login/captcha 回头再看看有没有什么解决方案, 不应该啊.
maybe无头模式被检测了?
from xhs.
from html 获取到的图片不清晰
直接通过 xhs.help.get_imgs_url_from_note(note)
把获取到的笔记传进去应该是无水印的图片了
from xhs.
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)
- 出现requests.exceptions.ConnectionError HOT 2
- 笔记发布接口提示TypeError
- 请求发布图片笔记接口报406 HOT 1
- ubuntu22.04版本的openssl3.0出现这个问题
- get_note_by_id 返回461错误 HOT 1
- 获取话题的发布问题 HOT 2
- report_note_metrics方法时好时坏 HOT 1
- 获取笔记评论 提示 超时 HOT 3
- 有获取创作者cookie的api吗 HOT 3
- 可以支持回复私信的功能吗? HOT 6
- 为什么这里可以不传 a1 参数 HOT 1
- xhs 发布图文提示“技术升级中”,请教这是什么原因导致的呢?
- 刚注册的新号,调用二维码接口获取到二维码之后,手机上扫码成功,但是获取二维码扫描状态的接口 返回 461 或者 471 ,怎么解决。。。
- 赞 成功了,对面收不到,这种这么办?
- 拉不了吗
- 是验证码。就是那个横着滑动的。edith.xiaohongshu.com/api/redcaptcha/v2/captcha/register 申请2张图,提交一个角度和触摸轨迹,就能继续了。验证码挺简单的,github上有开源的代码。
- 获取主页推荐 报错 HOT 1
- 调用 xhs_client.activate() 方法报错, 返回 code = -1 应该是加密错误 但是使用 pip install xhs 下载下来的包 调用 xhs_client.activate() 返回正常
- Ubuntu环境下运行basic_usage.py卡在context.new_page()的环节
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xhs.