python采集电商jd app搜索商品数据(2023-10-30)

一、技术要点:


  1、cookie可以从手机app端用charles抓包获取;


  2、无需安装nodejs,纯python源码;


  3、搜索接口为:functionId=search;


  4、clientVersion = "10.1.4"同时也支持更高的版本;


  5、sign签名算法已转成python源码;


  6、body为:

{"addrFilter":"1","addressId":"0","articleEssay":"1","deviceidTail":"83","exposedCount":"0","frontExpids":"F_0_0","gcAreaId":"25,2258,2259,57314","gcLat":"24.343493","gcLng":"102.548052","imagesize":{"gridImg":"531x531","listImg":"390x390","longImg":"531x680"},"insertArticle":"1","insertScene":"1","insertedCount":"0","isCorrect":"1","keyword":keyword,"latitude":"24.343321","localNum":"0","longitude":"102.548038","newMiddleTag":"1","newVersion":"3","oneBoxMod":"1","orignalSearch":"1","orignalSelect":"1","page":page,"pageEntrance":"1","pagesize":"10","posAreaId":"25,2258,2259,57314","pvid":pvid,"searchVersionCode":"9398","secondInsedCount":"0","showShopTab":"yes","showStoreTab":"1","stock":"1"}

uri编码后为:

%7B%22addrFilter%22%3A%221%22%2C%22addressId%22%3A%220%22%2C%22articleEssay%22%3A%221%22%2C%22deviceidTail%22%3A%2283%22%2C%22exposedCount%22%3A%220%22%2C%22frontExpids%22%3A%22F_0_0%22%2C%22gcAreaId%22%3A%2225%2C2258%2C2259%2C57314%22%2C%22gcLat%22%3A%2224.343493%22%2C%22gcLng%22%3A%22102.548052%22%2C%22imagesize%22%3A%7B%22gridImg%22%3A%22531x531%22%2C%22listImg%22%3A%22390x390%22%2C%22longImg%22%3A%22531x680%22%7D%2C%22insertArticle%22%3A%221%22%2C%22insertScene%22%3A%221%22%2C%22insertedCount%22%3A%220%22%2C%22isCorrect%22%3A%221%22%2C%22keyword%22%3A%22%E5%B0%8F%E5%AD%A6%E7%94%9F%E4%B9%A6%E5%8C%85%22%2C%22latitude%22%3A%2224.343321%22%2C%22localNum%22%3A%220%22%2C%22longitude%22%3A%22102.548038%22%2C%22newMiddleTag%22%3A%221%22%2C%22newVersion%22%3A%223%22%2C%22oneBoxMod%22%3A%221%22%2C%22orignalSearch%22%3A%221%22%2C%22orignalSelect%22%3A%221%22%2C%22page%22%3A%221%22%2C%22pageEntrance%22%3A%221%22%2C%22pagesize%22%3A%2210%22%2C%22posAreaId%22%3A%2225%2C2258%2C2259%2C57314%22%2C%22pvid%22%3A%22%22%2C%22searchVersionCode%22%3A%229398%22%2C%22secondInsedCount%22%3A%220%22%2C%22showShopTab%22%3A%22yes%22%2C%22showStoreTab%22%3A%221%22%2C%22stock%22%3A%221%22%7D&

  7、sign签名需要的参数:


  sign=service.get_st_sign_sv(data_json, functionId, uuid, clientVersion)
  data_json   :即body
  functionId  :接口类型,即:functionId ="search"
  uuid           :设备标识,可抓包取得,即:uuid="d5aada6c69ce7237"
  clientVersion:app版本号,即:clientVersion = "10.1.4"

# -*- coding: UTF-8 -*-
import requests,json
import pkgutil
import time
from urllib.parse import urlparse, parse_qs, urlunparse
import hashlib
import execjs
from urllib.parse import quote
import io
import sys
from coreMethod import servicedef savetofile(text,filename):file = open(filename, "w",encoding='utf-8' )file.write(text)file.close()def print_hi(name):# Use a breakpoint in the code line below to debug your script.print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.def jdsearch(keyword,page,pvid):body={"addrFilter":"1","addressId":"0","articleEssay":"1","deviceidTail":"83","exposedCount":"0","frontExpids":"F_0_0","gcAreaId":"25,2258,2259,57314","gcLat":"24.343493","gcLng":"102.548052","imagesize":{"gridImg":"531x531","listImg":"390x390","longImg":"531x680"},"insertArticle":"1","insertScene":"1","insertedCount":"0","isCorrect":"1","keyword":keyword,"latitude":"24.343321","localNum":"0","longitude":"102.548038","newMiddleTag":"1","newVersion":"3","oneBoxMod":"1","orignalSearch":"1","orignalSelect":"1","page":page,"pageEntrance":"1","pagesize":"10","posAreaId":"25,2258,2259,57314","pvid":pvid,"searchVersionCode":"9398","secondInsedCount":"0","showShopTab":"yes","showStoreTab":"1","stock":"1"}data_json = json.dumps(body, ensure_ascii=False, separators=(",", ":"))data="body="+quote(data_json)+"&"data_len=len(data)print(data_len)functionId ="search"uuid="d5aada6c69ce7237"     # uuid = "ZNVrYWHrDwC2EWDvDzSzDm=="clientVersion = "10.1.4"api_url="https://api.m.jd.com/client.action?functionId=search&clientVersion=10.1.4&build=90060&client=android&d_brand=Xiaomi&d_model=MI4LTE&osVersion=6.0.1&screen=1920*1080&partner=ks006&oaid=&eid=eidA0c138122bas4uo1qCosmRnqrZBkTZ+zEF7qNa5UCxrzSE5IyVBHJw4jzuBKyNz0TPXE0oY0j0H/viRPJy5RUE1KWCJuMWV52ufEtPyZiLpXsetVD&sdkVersion=23&lang=zh_CN&eu=8363533373230323933313336333&fv=93D2634303938303363663032626&uuid=d5aada6c69ce7237&aid=d5aada6c69ce7237&area=25_2258_2259_57314&networkType=wifi&wifiBssid=d9077de60f51d1d1d6f228a96f318e0c&uts=0f31TVRjBSsqndu4%2FjgUPz6uymy50MQJ57QGqe4EVdPCC%2F%2BLaIc%2B0FPy%2BbUQbRC5NoDqqw5SzXn%2B5IzKEzRV7U4tEboVX3RmAjshdIn%2BrmSbjWta516veiyWgiDkt89AHGr9Rp0fcz01k8UAHnDKv9FJVcx9o%2BHKLIDKAa6QQUSBNqX7wvJlkldVcZElJ1qX8Gf%2F4RKU8CYMjipFaink5w%3D%3D&uemps=0-0&harmonyOs=0";sign=service.get_st_sign_sv(data_json, functionId, uuid, clientVersion)# print('技术支持:复制:byc6352')api_url=api_url+'&'+signreal_url = api_url.replace("https://api.m.jd.com", "")print(real_url)# print(data_json)# data_url=quote(data_json)# print(data_url)headers={"method":"POST","path": real_url,"scheme": "https","charset": "UTF-8","jdc-backup": 'pin=jd_eiFeOmfKYTrp;wskey=AAJk-9PXAEDx4VigFTYENYvbbF_ih0fwKNPxtlGjLBxeKZDIHTo0dlOGi9kthRmaIPxAQc8LOjXjivrJlZRmTDk92_7gn7xD;whwswswws=AAo0qnXeKECW5dHtHD2SyG-aA65Td2U3WT7WUwAAAAAA;unionwsws={"devicefinger":"eidA0c138122bas4uo1qCosmRnqrZBkTZ+zEF7qNa5UCxrzSE5IyVBHJw4jzuBKyNz0TPXE0oY0j0H\/viRPJy5RUE1KWCJuMWV52ufEtPyZiLpXsetVD","jmafinger":"AAo0qnXeKECW5dHtHD2SyG-aA65Td2U3WT7WUwAAAAAA"};',"Authority": "api.m.jd.com","Accept": "*/*",# "Accept-Encoding": "br,gzip,deflate","Accept-Language": "zh-CN,zh;q=0.9","Cookie": 'pin=jd_LStcEbIzGjuR;wskey=AAJkcwjDAECOW8kziBHNbB1cl-BdbgXIW1TU1mHHu7XkyHRHGTt36GiksxgJbLVNZ4Ni-XKKKXahMVmrVoH6IagBm2_RD_-n;whwswswws=JD012145b9Ooh6gW1WYH168526050472603eFWOcdKH3-r3FyvX7W1dFwIKf7xAscQeSZ4_zhAV07wcda_pYWPbGQW_fnTydijhfpLKLUlVzIXVOor8dB-N7vkfs3rWJTxi0p1xghd~lnPHS6M-VPm1DZUIGaKbW62XTKAcWHCstLD9GZCUslR9H9xVy8TeBaMkOHcMNNOZ-86d4vztzqMQD2jeEoOoHmHbOUCNqSQL3MKF19Ct66wbQf3UlOZ7A9SdiTCPFifNr5Fwf7rWgoO2rnN4XQXFJ-YkcJvtdXPQ11I6r3V44VJc;unionwsws={"devicefinger":"eidAe50181223cs8uIOuW0dWRka9iu\/jXMDOK7iDr+Oor0tc4JwaCNymIsN1KVlEBsjUDXYycNGHW5iEV8gds4\/u1TN0isUUwp8eUG+Fk\/pxSMrh\/flR","jmafinger":"JD012145b9Ooh6gW1WYH168526050472603eFWOcdKH3-r3FyvX7W1dFwIKf7xAscQeSZ4_zhAV07wcda_pYWPbGQW_fnTydijhfpLKLUlVzIXVOor8dB-N7vkfs3rWJTxi0p1xghd~lnPHS6M-VPm1DZUIGaKbW62XTKAcWHCstLD9GZCUslR9H9xVy8TeBaMkOHcMNNOZ-86d4vztzqMQD2jeEoOoHmHbOUCNqSQL3MKF19Ct66wbQf3UlOZ7A9SdiTCPFifNr5Fwf7rWgoO2rnN4XQXFJ-YkcJvtdXPQ11I6r3V44VJc"};',"cache-control": "no-cache","content-type": "application/x-www-form-urlencoded; charset=UTF-8","content-length": str(data_len),"user-agent": "okhttp/3.12.1;jdmall;android;version/10.1.4;build/90060;screen/1080x1920;os/6.0.1;network/wifi;",}# body.encode(encoding='utf-8')res=requests.post(url=api_url, headers=headers,data=data)print(res)text=res.textsavetofile(text,"data.txt")print(text)return text# Press the green button in the gutter to run the script.
if __name__ == '__main__':print_hi('京东app搜索接口。技术支持:v+:byc6352;~~~~:39848872')keyword="小学生书包"page="1"pvid=""  #为空jdsearch(keyword,page,pvid)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/124139.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

“道法自然——徐铭中国画展”在中国美术馆隆重开幕

10月28日上午,“道法自然——徐铭中国画作品展”在中国美术馆隆重开幕。本次展览由中国科学院大学、民盟中央美术院联合主办。第十四届全国人大常委会委员、财政经济委员会副主任委员、民盟中央副主席谢经荣,第十四届全国政协副秘书长、民盟中央副主席、…

数字孪生智慧工厂三维可视化系统解决方案,打造新一代智慧工厂

在制造业的快速发展和数字化转型的时代,智慧工厂已经成为制造企业前进的必经之路。数字孪生技术,作为工业数字化转型的核心动力,为打造智慧工厂提供了关键支持。其中,数字孪生智慧工厂三维可视化系统解决方案无疑是制造企业的得力…

2023深耕kotlin,谈谈前景

为什么学习kotlin? Kotlin 早就已经是 Google 官方推荐的开发语言了,而且 Android 新的 Compose 框架只支持 Kotlin ,在 Google 那里,Android开发中 Java 其实已经被淘汰了。Java 和 Kotlin 虽然都属于高级语言,但是 …

Python 自动化测试全攻略:五种自动化测试模型实战详解!

随着移动互联网的发展,软件研发模型逐步完善,软件交付质量越来越受到软件公司的重视,软件测试技术特别是自动化测试技术开始在软件系统研发过程中发挥着越来越重要的作用。 与传统的手工测试技术相比,自动化测试具备了良好的可操…

iPhone无法关机未必是坏了!如何修复无法关闭的iPhone

iPhone运行很慢且发热是一个比较罕见的情况,但如果它发生在你身上,下面解释了发生的原因以及你如何修复它。 iPhone无法关闭的原因 iPhone无法关闭的最可能原因是: 由于软件问题,它被冻结了。 睡眠/唤醒按钮坏了。 屏幕坏了&a…

服务器感染了.mxdown-V-XXXXXXXX勒索病毒,如何确保数据文件完整恢复?

尊敬的读者: 在当今数字化时代,网络犯罪的阴谋在虚拟世界中蔓延,mxdown-V-XXXXXXXX、.vollhavhelp-V-XXXXXXXX、.arricklu-V-XXXXXXXX勒索病毒是其中的恶梦般存在,这三种勒索病毒均属于同一个勒索病毒家族旗下。这种勒索病毒以其…

真心话坦白局系统源码

它具有匿名信息的神秘感 但又会给你一点小提示 能让你有无限挖掘下去的好奇感 也能让你说出那些不敢说出口的话 敢来一场坦白局吗! 坦白局这个功能类似于悄悄话,只不过是匿名的悄悄话。 有时候我们有些话是开不了口的,坦白局给了我们一个…

【音视频|PCM】PCM格式详解

😁博客主页😁:🚀https://blog.csdn.net/wkd_007🚀 🤑博客内容🤑:🍭嵌入式开发、Linux、C语言、C、数据结构、音视频🍭 🤣本文内容🤣&a…

jenkins详细安装教程

这里写目录标题 一、Jenkins安装与部署1-1、Jenkins的简介1-2、下载需要的软件1-2-1 jekins.war1-2-2 tomcat安装方式 1-3、使用11版本的jdk1-4、开启jenkins1-5、获取密码1-5 修改镜像(可改可不改) 二、卸载Jenkins 一、Jenkins安装与部署 1-1、Jenkins的简介 Jenkins是一个…

比较浮点数时,我被绊倒了

📢欢迎点赞 :👍 收藏 ⭐留言 📝 如有错误敬请指正,赐人玫瑰,手留余香!📢本文作者:由webmote 原创📢作者格言:新的征程,我们面对的不是…

C++之string

C之string #include <iostream>using namespace std;/*string();//创建一个空的字符串string(const char* s);//使用字符串s初始化string(const string& str);//使用一个string对象初始化另外一个string对象string(int n,char c);//使用n个字符c初始化*/void test1()…

【计算机网络】浏览器的通信能力

1. 用户代理 浏览器可以代替用户完成http请求&#xff0c;代替用户解析响应结果&#xff0c;所以我们称之为用户代理 user agent。 浏览器两大核心能力&#xff1a; 自动发送请求的能力自动解析响应的能力 1.1 自动发送请求的能力 用户在地址栏输入了一个url地址&#xff0…

eslint提示 xxx should be listed in the project's dependencies

有时候手动安装了一个npm包A&#xff0c;npm包A里面包含了npm包B&#xff0c;这时候如果 import xxx from npm包B;eslint会报错&#xff0c;提示 npm包B 不在 package.json 里面 解决方法&#xff1a;在 eslintrc.js 增加配置 module.exports {rules: {import/no-extraneous-d…

GEO生信数据挖掘(十一)STRING数据库PPI蛋白互作网络 Cytoscape个性化绘图【SCI 指日可待】

GEO生信数据挖掘&#xff08;十&#xff09;肺结核数据-差异分析-WGCNA分析&#xff08;900行代码整理注释更新版本&#xff09; 通过 前面十篇文章的学习&#xff0c;我们应该已经可以获取到一个”心仪的基因列表“了&#xff0c;相较于原始基因数量&#xff0c;这个列表的数…

目标检测算法发展史

前言 比起图像识别&#xff0c;现在图片生成技术要更加具有吸引力&#xff0c;但是要步入AIGC技术领域&#xff0c;首先不推荐一上来就接触那些已经成熟闭源的包装好了再提供给你的接口网站&#xff0c;会使用别人的模型生成一些图片就能叫自己会AIGC了吗&#xff1f;那样真正…

定档11月2日,YashanDB 2023年度发布会完整议程公布

数据库作为支撑核心业务的关键技术&#xff0c;对数字经济的发展有着重要的支撑作用&#xff0c;随着云计算、AI等技术的迅猛发展和数据量的爆发式增长&#xff0c;推动着数据库技术的加速创新。 为了应对用户日益复杂的数据管理需求&#xff0c;赋能行业国产化建设和数字化转型…

Windows详细安装和彻底删除RabbitMQ图文流程

RabbiitMQ简介 RabbitMQ是实现了高级消息队列协议&#xff08;AMQP&#xff1a;Advanced Message Queue Protocol&#xff09;的开源消息代理软件&#xff08;亦称面向消息的中间件&#xff09;。RabbitMQ服务器是用Erlang语言编写的&#xff0c;而聚类和故障转移是构建在开放…

C语言-递归和迭代

&#x1f308;write in front&#x1f308; &#x1f9f8;大家好&#xff0c;我是Aileen&#x1f9f8;.希望你看完之后&#xff0c;能对你有所帮助&#xff0c;不足请指正&#xff01;共同学习交流. &#x1f194;本文由Aileen_0v0&#x1f9f8; 原创 CSDN首发&#x1f412; 如…

Windows下Redis配置密码,并设置自启动

1. 解压redis修改配置文件&#xff08;设置密码&#xff09; 打开Redis的配置文件&#xff0c;通常位于Redis安装目录下的 redis.windows.conf 去掉"requirepass"前注释&#xff0c;修改"foobared"为要设置的密码 requirepass foobared2.注册服务&#x…

SpringCloud之Eureka的学习【详细】

目录 服务架构演变 单体架构 分布式架构 分布式架构需要考虑的问题 微服务 架构比较 微服务技术对比 服务拆分注意事项 案例 服务远程调用 RestTemplate Eureka注册中心 RestTemplate存在的问题 服务调用考虑的问题 Eureka的作用 搭建EurekaServer 服务注册 …