diff --git a/_sources/basic.rst.txt b/_sources/basic.rst.txt index 1f2e5a9..ac6e608 100644 --- a/_sources/basic.rst.txt +++ b/_sources/basic.rst.txt @@ -25,17 +25,17 @@ 进阶使用 ---------------- -将 playwright 封装为服务端,主函数使用 requests 请求,获取签名。 +将 playwright 封装为服务端,主函数使用 requests 请求,获取签名,多账号使用统一签名服务请确保 cookie 中的 a1 字段统一,防止签名一直出现错误 环境安装 ^^^^^^^^^^^^^^^^^^^^^^ -可以直接使用 Docker 来起下面的 Flask 服务,然后使用 XhsClient 即可,注意端口变成了 8080 +可以直接使用 Docker 来起下面的 Flask 服务,然后使用 XhsClient 即可,服务启动会打印 a1,推荐将自己的 cookie 中的 a1 与服务端设置成一致 .. code-block:: bash - docker run -it -d -p 8080:8080 reajason/xhs-sign:latest + docker run -it -d -p 5005:5005 reajason/xhs-api:latest 如果在本机启动 Flask 需要安装如下依赖: @@ -50,6 +50,5 @@ 使用 XhsClient ^^^^^^^^^^^^^^^^^^^ -第一次请求会失败,但是之后的请求就正常了。 具体代码参考: `basic_sign_usage `_ diff --git a/basic.html b/basic.html index c781392..4ed1a42 100644 --- a/basic.html +++ b/basic.html @@ -54,11 +54,11 @@

基础使用

进阶使用

-

将 playwright 封装为服务端,主函数使用 requests 请求,获取签名。

+

将 playwright 封装为服务端,主函数使用 requests 请求,获取签名,多账号使用统一签名服务请确保 cookie 中的 a1 字段统一,防止签名一直出现错误

环境安装

-

可以直接使用 Docker 来起下面的 Flask 服务,然后使用 XhsClient 即可,注意端口变成了 8080

-
docker run -it -d -p 8080:8080 reajason/xhs-sign:latest
+

可以直接使用 Docker 来起下面的 Flask 服务,然后使用 XhsClient 即可,服务启动会打印 a1,推荐将自己的 cookie 中的 a1 与服务端设置成一致

+
docker run -it -d -p 5005:5005 reajason/xhs-api:latest
 

如果在本机启动 Flask 需要安装如下依赖:

@@ -72,7 +72,6 @@

开启 Flask 签名服务

使用 XhsClient

-

第一次请求会失败,但是之后的请求就正常了。

具体代码参考: basic_sign_usage

diff --git a/searchindex.js b/searchindex.js index 33602a1..14c2725 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["basic","crawl","creator","index","source/xhs"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":5,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["basic.rst","crawl.rst","creator.rst","index.rst","source/xhs.rst"],objects:{"xhs.FeedType":[[4,1,1,"","CAREER"],[4,1,1,"","COSMETICS"],[4,1,1,"","EMOTION"],[4,1,1,"","FASION"],[4,1,1,"","FITNESS"],[4,1,1,"","FOOD"],[4,1,1,"","GAME"],[4,1,1,"","HOURSE"],[4,1,1,"","MOVIE"],[4,1,1,"","RECOMMEND"],[4,1,1,"","TRAVEL"]],"xhs.XhsClient":[[4,2,1,"","activate"],[4,2,1,"","check_code"],[4,2,1,"","check_qrcode"],[4,2,1,"","collect_note"],[4,2,1,"","comment_note"],[4,2,1,"","comment_user"],[4,3,1,"","cookie"],[4,3,1,"","cookie_dict"],[4,2,1,"","create_image_note"],[4,2,1,"","create_note"],[4,2,1,"","create_video_note"],[4,2,1,"","delete_note_comment"],[4,2,1,"","dislike_comment"],[4,2,1,"","dislike_note"],[4,2,1,"","follow_user"],[4,2,1,"","get"],[4,2,1,"","get_emojis"],[4,2,1,"","get_home_feed"],[4,2,1,"","get_home_feed_category"],[4,2,1,"","get_note_all_comments"],[4,2,1,"","get_note_by_id"],[4,2,1,"","get_note_by_id_from_html"],[4,2,1,"","get_note_by_keyword"],[4,2,1,"","get_note_comments"],[4,2,1,"","get_note_sub_comments"],[4,2,1,"","get_qrcode"],[4,2,1,"","get_search_suggestion"],[4,2,1,"","get_self_info"],[4,2,1,"","get_self_info2"],[4,2,1,"","get_suggest_ats"],[4,2,1,"","get_suggest_topic"],[4,2,1,"","get_upload_files_permit"],[4,2,1,"","get_user_all_notes"],[4,2,1,"","get_user_collect_notes"],[4,2,1,"","get_user_info"],[4,2,1,"","get_user_like_notes"],[4,2,1,"","get_user_notes"],[4,2,1,"","get_video_first_frame_image_id"],[4,2,1,"","like_comment"],[4,2,1,"","like_note"],[4,2,1,"","login_code"],[4,2,1,"","post"],[4,2,1,"","report_note_metrics"],[4,2,1,"","request"],[4,2,1,"","save_files_from_note_id"],[4,2,1,"","send_code"],[4,3,1,"","session"],[4,2,1,"","uncollect_note"],[4,2,1,"","unfollow_user"],[4,2,1,"","upload_file"],[4,3,1,"","user_agent"]],xhs:[[4,0,1,"","FeedType"],[4,0,1,"","XhsClient"]]},objnames:{"0":["py","class","Python \u7c7b"],"1":["py","attribute","Python \u5c5e\u6027"],"2":["py","method","Python \u65b9\u6cd5"],"3":["py","property","Python property"]},objtypes:{"0":"py:class","1":"py:attribute","2":"py:method","3":"py:property"},terms:{"10":[1,4],"11":4,"12":4,"20":4,"2023":4,"280148":4,"30":4,"8080":0,"86":4,"87323168":4,"default":4,"enum":4,"for":4,"function":4,"if":4,"in":4,"int":4,"return":4,"true":4,"with":4,a1:0,abnorm:4,activ:4,all:4,an:4,and:4,api:4,argument:4,as:4,ats:4,author:4,basic_sign_serv:0,basic_sign_usag:0,basic_usag:0,be:4,bool:4,by:4,can:4,career:4,career_v3:4,cdn:0,check_cod:4,check_qrcod:[1,4],code:4,collect_not:[1,4],com:[3,4],comment:4,comment_id:4,comment_not:[1,4],comment_us:4,content:4,content_typ:4,cooki:[0,1,4],cookie_dict:4,core:4,cosmet:4,cosmetics_v3:4,count:4,cover:4,cover_path:4,crawl:4,crawl_interv:4,creat:4,create_image_not:4,create_not:4,create_video_not:4,creator:3,curl:0,cursor:4,data:4,delete_note_com:[1,4],desc:4,dict:4,dir_path:4,directori:4,dislike_com:[1,4],dislike_not:[1,4],display_titl:4,docker:0,don:4,emot:4,enumer:4,equal:4,explor:4,fact:4,fals:4,fashion_v3:4,fasion:4,feed_typ:4,feedtyp:1,fetch:4,file:4,file_id:4,file_path:4,file_typ:4,first:4,fit:4,fitness_v3:4,flask:3,follow:4,follow_us:[1,4],followed_author:4,food:4,food_v3:4,from:4,game:4,gaming_v3:4,gener:4,get:4,get_emoji:4,get_home_fe:[1,4],get_home_feed_categori:4,get_note_all_com:4,get_note_by_id:[1,4],get_note_by_id_from_html:4,get_note_by_keyword:[1,4],get_note_com:[1,4],get_note_sub_com:[1,4],get_qrcod:[1,4],get_search_suggest:4,get_self_info2:4,get_self_info:[1,4],get_suggest_at:4,get_suggest_top:4,get_upload_files_permit:4,get_user_all_not:4,get_user_collect_not:[1,4],get_user_info:[1,4],get_user_like_not:[1,4],get_user_not:[1,4],get_video_first_frame_image_id:4,gevent:0,gh:0,greater:4,has:4,has_mor:4,have:4,homefe:4,homefeed_recommend:4,hours:4,household_product_v3:4,http:[0,4],id:[1,4],ignor:4,imag:4,image_info:4,includ:4,info:4,input:4,instal:0,interact:4,interact_info:4,interv:4,is:4,is_creat:4,is_priv:4,it:[0,4],item:4,jpeg:4,js:0,jsdelivr:0,just:4,keyword:4,kwarg:4,last:4,latest:0,like_com:[1,4],like_not:[1,4],list:4,login_cod:4,love_v3:4,method:4,metric:4,min:0,mobile_token:4,more:4,movi:4,movie_and_tv_v3:4,mp4:4,multi_flag:4,must:4,net:0,none:4,note:4,note_id:4,note_titl:4,note_typ:4,note_user_id:4,num:4,number:4,obj:4,object:4,onli:4,option:4,order:4,other:4,page:4,page_s:4,param:4,parent:4,phone:4,pip:0,playwright:0,png:4,post:4,post_tim:4,properti:4,proxi:[1,4],py:0,python:4,qr_id:4,qrcode:4,reajason:[0,4],recommend:[1,4],report:4,report_note_metr:4,report_typ:4,request:[0,4],requirecool:0,respons:4,root_comment_id:4,run:0,same:4,save:4,save_files_from_note_id:4,search:4,searchnotetyp:4,searchsorttyp:4,second:4,send_cod:4,session:4,sign:[0,4],simpl:4,size:4,sleep:4,so:4,sort:4,stai:4,stay_second:4,stealth:0,store:4,str:4,sub:4,that:4,thi:4,timeout:[1,4],titl:4,to:4,token:4,topic:4,trasform:4,travel:4,travel_v3:4,tupl:4,twice:4,type:4,uncollect_not:[1,4],unfollow_us:[1,4],upload_fil:4,uri:4,url:4,user:4,user_ag:[1,4],user_id:4,valu:4,video:4,video_id:4,video_info:4,video_path:4,viewer:4,viewer_user_id:4,wait_tim:4,want:4,web_sess:0,webid:0,what:4,which:4,will:4,www:[3,4],xhs:[0,1,3,4],xhs_client:1,xhsclient:[1,3],xhsdiscov:4,xiaohongshu:[3,4],you:4,your:4,zone:4},titles:["\u5feb\u901f\u5165\u95e8","\u4e3b\u9875\u722c\u53d6","\u7b14\u8bb0\u53d1\u5e03","\u4ecb\u7ecd","Documentation"],titleterms:{"class":4,document:4,feedtyp:4,flask:0,the:4,xhsclient:[0,4]}}) \ No newline at end of file +Search.setIndex({docnames:["basic","crawl","creator","index","source/xhs"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":5,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["basic.rst","crawl.rst","creator.rst","index.rst","source/xhs.rst"],objects:{"xhs.FeedType":[[4,1,1,"","CAREER"],[4,1,1,"","COSMETICS"],[4,1,1,"","EMOTION"],[4,1,1,"","FASION"],[4,1,1,"","FITNESS"],[4,1,1,"","FOOD"],[4,1,1,"","GAME"],[4,1,1,"","HOURSE"],[4,1,1,"","MOVIE"],[4,1,1,"","RECOMMEND"],[4,1,1,"","TRAVEL"]],"xhs.XhsClient":[[4,2,1,"","activate"],[4,2,1,"","check_code"],[4,2,1,"","check_qrcode"],[4,2,1,"","collect_note"],[4,2,1,"","comment_note"],[4,2,1,"","comment_user"],[4,3,1,"","cookie"],[4,3,1,"","cookie_dict"],[4,2,1,"","create_image_note"],[4,2,1,"","create_note"],[4,2,1,"","create_video_note"],[4,2,1,"","delete_note_comment"],[4,2,1,"","dislike_comment"],[4,2,1,"","dislike_note"],[4,2,1,"","follow_user"],[4,2,1,"","get"],[4,2,1,"","get_emojis"],[4,2,1,"","get_home_feed"],[4,2,1,"","get_home_feed_category"],[4,2,1,"","get_note_all_comments"],[4,2,1,"","get_note_by_id"],[4,2,1,"","get_note_by_id_from_html"],[4,2,1,"","get_note_by_keyword"],[4,2,1,"","get_note_comments"],[4,2,1,"","get_note_sub_comments"],[4,2,1,"","get_qrcode"],[4,2,1,"","get_search_suggestion"],[4,2,1,"","get_self_info"],[4,2,1,"","get_self_info2"],[4,2,1,"","get_suggest_ats"],[4,2,1,"","get_suggest_topic"],[4,2,1,"","get_upload_files_permit"],[4,2,1,"","get_user_all_notes"],[4,2,1,"","get_user_collect_notes"],[4,2,1,"","get_user_info"],[4,2,1,"","get_user_like_notes"],[4,2,1,"","get_user_notes"],[4,2,1,"","get_video_first_frame_image_id"],[4,2,1,"","like_comment"],[4,2,1,"","like_note"],[4,2,1,"","login_code"],[4,2,1,"","post"],[4,2,1,"","report_note_metrics"],[4,2,1,"","request"],[4,2,1,"","save_files_from_note_id"],[4,2,1,"","send_code"],[4,3,1,"","session"],[4,2,1,"","uncollect_note"],[4,2,1,"","unfollow_user"],[4,2,1,"","upload_file"],[4,3,1,"","user_agent"]],xhs:[[4,0,1,"","FeedType"],[4,0,1,"","XhsClient"]]},objnames:{"0":["py","class","Python \u7c7b"],"1":["py","attribute","Python \u5c5e\u6027"],"2":["py","method","Python \u65b9\u6cd5"],"3":["py","property","Python property"]},objtypes:{"0":"py:class","1":"py:attribute","2":"py:method","3":"py:property"},terms:{"10":[1,4],"11":4,"12":4,"20":4,"2023":4,"280148":4,"30":4,"5005":0,"86":4,"87323168":4,"default":4,"enum":4,"for":4,"function":4,"if":4,"in":4,"int":4,"return":4,"true":4,"with":4,a1:0,abnorm:4,activ:4,all:4,an:4,and:4,api:[0,4],argument:4,as:4,ats:4,author:4,basic_sign_serv:0,basic_sign_usag:0,basic_usag:0,be:4,bool:4,by:4,can:4,career:4,career_v3:4,cdn:0,check_cod:4,check_qrcod:[1,4],code:4,collect_not:[1,4],com:[3,4],comment:4,comment_id:4,comment_not:[1,4],comment_us:4,content:4,content_typ:4,cooki:[0,1,4],cookie_dict:4,core:4,cosmet:4,cosmetics_v3:4,count:4,cover:4,cover_path:4,crawl:4,crawl_interv:4,creat:4,create_image_not:4,create_not:4,create_video_not:4,creator:3,curl:0,cursor:4,data:4,delete_note_com:[1,4],desc:4,dict:4,dir_path:4,directori:4,dislike_com:[1,4],dislike_not:[1,4],display_titl:4,docker:0,don:4,emot:4,enumer:4,equal:4,explor:4,fact:4,fals:4,fashion_v3:4,fasion:4,feed_typ:4,feedtyp:1,fetch:4,file:4,file_id:4,file_path:4,file_typ:4,first:4,fit:4,fitness_v3:4,flask:3,follow:4,follow_us:[1,4],followed_author:4,food:4,food_v3:4,from:4,game:4,gaming_v3:4,gener:4,get:4,get_emoji:4,get_home_fe:[1,4],get_home_feed_categori:4,get_note_all_com:4,get_note_by_id:[1,4],get_note_by_id_from_html:4,get_note_by_keyword:[1,4],get_note_com:[1,4],get_note_sub_com:[1,4],get_qrcod:[1,4],get_search_suggest:4,get_self_info2:4,get_self_info:[1,4],get_suggest_at:4,get_suggest_top:4,get_upload_files_permit:4,get_user_all_not:4,get_user_collect_not:[1,4],get_user_info:[1,4],get_user_like_not:[1,4],get_user_not:[1,4],get_video_first_frame_image_id:4,gevent:0,gh:0,greater:4,has:4,has_mor:4,have:4,homefe:4,homefeed_recommend:4,hours:4,household_product_v3:4,http:[0,4],id:[1,4],ignor:4,imag:4,image_info:4,includ:4,info:4,input:4,instal:0,interact:4,interact_info:4,interv:4,is:4,is_creat:4,is_priv:4,it:[0,4],item:4,jpeg:4,js:0,jsdelivr:0,just:4,keyword:4,kwarg:4,last:4,latest:0,like_com:[1,4],like_not:[1,4],list:4,login_cod:4,love_v3:4,method:4,metric:4,min:0,mobile_token:4,more:4,movi:4,movie_and_tv_v3:4,mp4:4,multi_flag:4,must:4,net:0,none:4,note:4,note_id:4,note_titl:4,note_typ:4,note_user_id:4,num:4,number:4,obj:4,object:4,onli:4,option:4,order:4,other:4,page:4,page_s:4,param:4,parent:4,phone:4,pip:0,playwright:0,png:4,post:4,post_tim:4,properti:4,proxi:[1,4],py:0,python:4,qr_id:4,qrcode:4,reajason:[0,4],recommend:[1,4],report:4,report_note_metr:4,report_typ:4,request:[0,4],requirecool:0,respons:4,root_comment_id:4,run:0,same:4,save:4,save_files_from_note_id:4,search:4,searchnotetyp:4,searchsorttyp:4,second:4,send_cod:4,session:4,sign:4,simpl:4,size:4,sleep:4,so:4,sort:4,stai:4,stay_second:4,stealth:0,store:4,str:4,sub:4,that:4,thi:4,timeout:[1,4],titl:4,to:4,token:4,topic:4,trasform:4,travel:4,travel_v3:4,tupl:4,twice:4,type:4,uncollect_not:[1,4],unfollow_us:[1,4],upload_fil:4,uri:4,url:4,user:4,user_ag:[1,4],user_id:4,valu:4,video:4,video_id:4,video_info:4,video_path:4,viewer:4,viewer_user_id:4,wait_tim:4,want:4,web_sess:0,webid:0,what:4,which:4,will:4,www:[3,4],xhs:[0,1,3,4],xhs_client:1,xhsclient:[1,3],xhsdiscov:4,xiaohongshu:[3,4],you:4,your:4,zone:4},titles:["\u5feb\u901f\u5165\u95e8","\u4e3b\u9875\u722c\u53d6","\u7b14\u8bb0\u53d1\u5e03","\u4ecb\u7ecd","Documentation"],titleterms:{"class":4,document:4,feedtyp:4,flask:0,the:4,xhsclient:[0,4]}}) \ No newline at end of file