当前位置:网站首页>Get the data of Tongcheng (elong) Hotel
Get the data of Tongcheng (elong) Hotel
2022-07-24 17:38:00 【tslilove】
Statement
All contents in this article are for learning and communication only , The content of the package 、 Sensitive website 、 All data interfaces have been desensitized , It is strictly prohibited to use for commercial and illegal purposes , Otherwise, all the consequences have nothing to do with the author , If there is infringement , Please contact me to delete !
Target home page :aHR0cHM6Ly93d3cubHkuY29tLw==
Interface :aHR0cHM6Ly93d3cubHkuY29tL3RhcGkvdjIvbGlzdA==
Choose here ①,②,③ Three settings , If you have other requirements, you can check accordingly

The position marked in the figure is the acquisition object

We click search , Then press F12, Click next , By grabbing bags , We found out that it was through JSON Format data returned , And one to one

Let's look at the request parameters , Marked in the figure 3 The point needs to be set simply , Others can be fixed

Many people here have seen it , Isn't it OK to have hands , Then bring the request header and the corresponding parameters , Just make a request , The data is found to be duplicate , Then what shall I do? ? Was it crawling backwards ? With a hesitant attitude , Let's move on

Let's click on the next page to see , Found a new request , Then compare the two request headers , It is found that there is a parameter value that changes dynamically , you 're right , Namely traceid, It changes every time , Then what shall I do? ?
After my debugging , This site feels like it's not doing anything to hide , We search directly for

Then I will come to such a place

Make a short mark , Click next , And then the next step , Output it on the console , This is what we want

Then step in , See how it is constructed , This is the picture below , Function is w One way to get

function w() {
for (var t = [], e = "0123456789abcdef", n = 0; n < 36; n++)
t[n] = e.substr(Math.floor(16 * Math.random()), 1);
t[14] = "4",
t[19] = e.substr(3 & t[19] | 8, 1),
t[8] = t[13] = t[18] = t[23] = "-";
var i = t.join("");
return i
}
utilize python Restore
import requests
import numpy as np
import time
def getData(page):
url = "https://www.ly.com/tapi/v2/list"
data = {
"city": "53",
"inDate": "2022-07-21",
"outDate": "2022-07-22",
"filterList": "8888_1",
"pageIndex": str(page),
"pageSize": "20",
"sugActInfo": "",
"traceToken":"|*|cityId:101|*|qId:60f5dd2a-47d4-426a-923a-658f0d156bf3|*|st:city|*|sId:101|*|scene_ids:0|*|bkt:r1|*|"
}
headers = {
"Accept": "application/json, text/plain, */*",
"Accept-Encoding": "gzip, deflate, br",
"appfrom": "16",
"cluster": "idc",
"Connection": "keep-alive",
"Cookie": "firsttime=1654522087825; H5CookieId=3e7c8fb2-6aa7-4979-a178-16f22a135dd0; NewProvinceId=3; NCid=53; NewProvinceName=%E5%8C%97%E4%BA%AC; NCName=%E5%8C%97%E4%BA%AC; Hm_lvt_64941895c0a12a3bdeb5b07863a52466=1658303906; Hm_lpvt_64941895c0a12a3bdeb5b07863a52466=1658303906; 17uCNRefId=RefId=14211945&SEFrom=bing&SEKeyWords=; TicketSEInfo=RefId=14211945&SEFrom=bing&SEKeyWords=; CNSEInfo=RefId=14211945&tcbdkeyid=&SEFrom=bing&SEKeyWords=&RefUrl=https%3A%2F%2Fcn.bing.com%2F; qdid=35297|1|14211945|dd62ba; route=9e4269ab1c446976d6f19828bedd499a; __tctmc=144323752.205791637; __tctmd=144323752.254392154; __tctma=144323752.1654522083234181.1654522083536.1654522083536.1658303905033.2; __tctmb=144323752.592073071986482.1658303905033.1658303905033.1; __tctmu=144323752.0.0; __tctmz=144323752.1658303905033.2.1.utmccn=(referral)|utmcsr=bing.com|utmcct=|utmcmd=referral; longKey=1654522083234181; __tctrack=0; Hm_lvt_c6a93e2a75a5b1ef9fb5d4553a2226e5=1658303908; Hm_lpvt_c6a93e2a75a5b1ef9fb5d4553a2226e5=1658303908; businessLine=hotel; H5Channel=mnoreferseo%2CSEO; indate=2022-07-20; outdate=2022-07-21; lasttime=1658303912283; JSESSIONID=0FC5AA1FB2953B247344B7B588966116",
"deviceid": "3e7c8fb2-6aa7-4979-a178-16f22a135dd0",
"Host": "www.ly.com",
"Referer": "https://www.ly.com/hotel/hotellist?city=53&inDate=2022-07-20&outDate=2022-07-21&filterList=8888_1&pageSize=20&t=1658303927222",
"Tmapi-Client": "tpc",
"traceid": getW(),#ctx.call("w"),
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 Edg/103.0.1264.62"
}
# print(ctx.call("w"))
resq = requests.get(url,params=data,headers=headers)
print(resq.json())
def run():
for page in range(1,5):
print(f" Getting {page} page ")
getData(page)
time.sleep(3)
if __name__ == '__main__':
run()
Initiate request , Before acquisition 4 Page look

Oh, my God , It's so sweet !!!
It's over here , I hope that's helpful , Problem communication !

边栏推荐
- In the morning, Tencent took out 38K, which let me see the ceiling of the foundation
- Js实现继承的六种方式
- Work with growingio engineers this time | startdt Hackathon
- Wrote a few small pieces of code, broke the system, and was blasted by the boss
- 安全:如何为行人提供更多保护
- 滚动条调整亮度和对比度
- Getaverse, a distant bridge to Web3
- Natbypass port forwarding
- C语言自定义类型讲解 — 联合体
- Portfwd port forwarding
猜你喜欢
随机推荐
C语言自定义类型讲解 — 结构体
TCP协议调试工具TcpEngine V1.3.0使用教程
[waiting for insurance] what does waiting for insurance rectification mean? What are the rectification contents?
Still using xshell? You are out, recommend a more modern terminal connection tool!
Tensorflow introductory tutorial (38) -- V2 net
JS & TS learning summary
Extension of ES6 function
Use 4D nerf to display occlusion (cvpr2022)
TCP protocol debugging tool tcpengine v1.3.0 tutorial
portfwd 端口转发
PAT甲级——签到与签出
Introduction and use of Pinia
Internship report 1 - face 3D reconstruction method
Iftnews | Christie's launched its venture capital department, aiming at Web3 and metauniverse industries
Openlayers: point aggregation effect
Natbypass port forwarding
Use Matplotlib to simulate linear regression
使用matplotlib模拟线性回归
A problem of MySQL database
NPM install reported -4058 error









