当前位置:网站首页>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 !

边栏推荐
- [GNN report] Tencent AI Lab Xu TingYang: graph generation model and its application in molecular generation
- Heuristic merging (including examples of general formula and tree heuristic merging)
- Scroll bar adjust brightness and contrast
- 700. 二叉搜索树中的搜索-dfs法
- C语言实现静态版本的通讯录
- 图像像素的逻辑操作
- Hcip fourth day notes
- Yolopose practice: one-stage human posture estimation with hands + code interpretation
- Can Lu Zhengyao hide from the live broadcast room dominated by Luo min?
- hcip第三天
猜你喜欢

portmap 端口转发

ansible自动化运维详解(五)ansible中变量的设定使用、JINJA2模板的使用以及ansible的加密控制
![[how to optimize her] teach you how to locate unreasonable SQL? And optimize her~~~](/img/10/996d594a53d9a34a36079fed829f27.png)
[how to optimize her] teach you how to locate unreasonable SQL? And optimize her~~~

Keyboard input operation

Canvas 从入门到劝朋友放弃(图解版)

Can Lu Zhengyao hide from the live broadcast room dominated by Luo min?

Getaverse, a distant bridge to Web3

快速完成intelij idea的单元测试JUnit4设置

Eth POS 2.0 stacking test network pledge process

Demonstration experiment of scrollbar for adjusting image brightness
随机推荐
PAT甲级——A + B 格式
Tensorflow introductory tutorial (37) -- DC Vnet
Safety: how to provide more protection for pedestrians
[how to optimize her] teach you how to locate unreasonable SQL? And optimize her~~~
Separation and merging of channels
Stop littering configuration files everywhere! Try our 7-year-old solution, which is stable
JS image conversion Base64 Base64 conversion to file object
Openlayers: point aggregation effect
Opencv has its own color operation
Step by step introduction to the development framework based on sqlsugar (12) -- split the content of the page module into components to realize the division and rule processing
213. 打家劫舍 II-动态规划
Three.js (7): local texture refresh
Natbypass port forwarding
Hcip day 3
Demonstration experiment of scrollbar for adjusting image brightness
Navicate connects Alibaba cloud (explanation of two methods and principles)
键盘输入操作
Nearly 30 colleges and universities were named and praised by the Ministry of education!
The results of the second quarter online moving people selection of "China Internet · moving 2022" were announced
ufw 端口转发