程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python crawler series get applet data algorithm

編輯:Python

Python Crawler series of the acquisition applet data Algorithm

If you have any questions > Click here to communicate with me <

Please scan the QR code below for wechat

The code is for learning and communication only , Do not use for illegal purposes

Go straight to the code

function e(t, e) {

return function(t) {

if (Array.isArray(t)) return t;
}(t) || function(t, e) {

var n = null == t ? null : "undefined" != typeof Symbol && t[Symbol.iterator] || t["@@iterator"];
if (null != n) {

var r, i, o = [], a = !0, s = !1;
................................
................................
................................
................................
................................
................................
});
}
}));
}
// Encryption function 
function encrypt(params, method){

/* params: Request parameters {"sortType": "0", "sortMode": "1", "limit": "20", "showHot": "1", "sign": "dd2d91e263187b0ee2ad510e8874031a"} method: Request method :GET POST return { ........................... ........................... ........................... ........................... } */
return E(JSON.stringify(params), method);
}
// Decryption function 
function decrypt(resp, b, e){

/* resp: Requested response data (json) b :encrypt Returned when generating encryption parameters json - b e :encrypt Returned when generating encryption parameters json - e return {"status":200,"data":{"total":256944,"totalText":"25 Thousands of pieces of + goods ","page":1,"lastId":"20","productList":[{"requestId":"","page":1,"dataType":0,"productId":10903,"spuId":10903,"propertyValueId":0,"propertyValue":"","logoUrl":"https://cdn.poizon.com/source-img/origin-img/20201205/8b325405f45b4988851ab5fc20bbfad7.jpg","images":["https://cdn.poizon.com/source-img/origin-img/20201205/8b325405f45b4988851ab5fc20bbfad7.jpg"],"title":"Nike Air Monarch 4 White Navy Cushioned and breathable retro sports dad shoes Unisex Bluish white ","subTitle":"","spuMinSalePrice":39900,"minSalePrice":39900,"maxSalePrice":0,"soldNum":584376,"favAll":0,"price":39900,"brandLogoUrl":"https://cdn.poizon.com/source-img/brand-img//bdd8b4fb815b4bcaa6136858f7f710a0-144.png","articleNumber":"415445-102","priceType":1,"goodsType":0,"type":1,"categoryId":36,"brandId":144,"acm":"1.srh.cspu_10903.0.default_risk-little_smartmenu-exp_rookie_discount_default-cache-exp.rid_e3ea53025aee12ab","isBrandPrice":0,"brandDirectSupply":0,"activityPrice":0,"underlineTagVo":[{"title":" Travel recommendation ","type":7,"sort":85,"imageUrl":"","startTime":1633009156000,"endTime":2147454847000}],"bidType":0,"newPeopleDiscountCandidate":true,"imageModels":[],"showImageModels":false},{"requestId":"e3ea53025aee12ab","page":1,"dataType":0,"productId":1373157,"spuId":1373157,"propertyValueId":0,"propertyValue":"","logoUrl":"https://cdn.poizon.com/pro-img/origin-img/20210304/bd1d71a939374058991bde2ad4f50856.jpg","images":["https://cdn.poizon.com/pro-img/origin-img/20210304/bd1d71a939374058991bde2ad4f50856.jpg"],"title":"LiNing Lining Sonic speed 9 Team Rebound and wear-resistant basketball shoes ice cream ","subTitle":"","spuMinSalePrice":45900,"minSalePrice":45900,"maxSalePrice":0,"soldNum":125096,"favAll":0,"price":45900,"brandLogoUrl":"https://cdn.poizon.com/source-img/brand-img//11e672600b29416c98fa98c427635ac7-33.png","articleNumber":"ABPR017-5","priceType":1,"goodsType":0,"type":1,"categoryId":31,"brandId":33,"acm":"1.srh.cspu_3651747.0.default_risk-little_smartmenu-exp_rookie_discount_default-cache-exp.rid_e3ea53025aee12ab","isBrandPrice":0,"brandDirectSupply":0,"activityPrice":0,"underlineTagVo":[{"title":" Travel recommendation ","type":7,"sort":85,"imageUrl":"","startTime":1633009156000,"endTime":2147454847000}],"bidType":0,"newPeopleDiscountCandidate":true,"imageModels":[],"showImageModels":false},{"requestId":"e3ea53025aee12ab","page":1,"dataType":0,"productId":1544857,"spuId":1544857,"propertyValueId":0,"propertyValue":"","logoUrl":"https://cdn.poizon.com/pro-img/origin-img/20210823/b37fcf42a4ca41cf82c4848d6d0ffc5c.jpg","images":["https://cdn.poizon.com/pro-img/origin-img/20210823/b37fcf42a4ca41cf82c4848d6d0ffc5c.jpg"],"title":"adidas originals Yeezy Boost 350 V2 \"Light\" White yellow change .................. */
return D(resp.data, b, e);
}
function getHtml(url, decryptParam){

let res = null;
const request = require('xmlhttprequest')
let xhr = new request.XMLHttpRequest();
xhr.open("GET", url, true);// Submit get Request to server 
xhr.setRequestHeader("AppId", "wxapp");
xhr.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat");
xhr.setRequestHeader("appVersion", "4.4.0");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("platform", "h5");
// xhr.setRequestHeader("Referer", "https://servicewechat.com/wx3c12cdd0ae8b1a7b/260/page-frame.html");
xhr.send(null);
xhr.onreadystatechange = function() {
// Server return value handler , Anonymous functions are used here to implement 
if (xhr.readyState == 4 && xhr.status == 200) {
//
var responseText = JSON.parse(xhr.responseText);
console.log(decrypt(responseText, decryptParam.a, decryptParam.c));
}
};
}
function demo(){

let params = {
"sortType": "0", "sortMode": "1", "limit": "20", "showHot": "1", "sign": "dd2d91e263187b0ee2ad510e8874031a"};
let resp = encrypt(params, "GET");
let data = JSON.parse(resp.d).data;
console.log(resp);
console.log(data);
let url = "https://app.dewu.com/api/v1/h5/search/fire/search/list?data=" + data;
getHtml(url, resp);
}
demo();

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved