我正在嘗試從將滑鼠懸停在地圖視圖中的標記上時出現的視窗中抓取資料,并從視窗中抓取“可用天數”值。

右鍵單擊然后復制 curl,然后使用此
您的代碼將如下所示:
import requests
headers = {
'authority': 'api.airdna.co',
'sec-ch-ua': '"Chromium";v="94", "Google Chrome";v="94", ";Not A Brand";v="99"',
'sec-ch-ua-mobile': '?0',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36',
'sec-ch-ua-platform': '"Windows"',
'accept': '*/*',
'origin': 'https://www.airdna.co',
'sec-fetch-site': 'same-site',
'sec-fetch-mode': 'cors',
'sec-fetch-dest': 'empty',
'referer': 'https://www.airdna.co/',
'accept-language': 'en-US,en;q=0.9',
}
params = (
('access_token', 'MjkxMTI|8b0178bf0e564cbf96fc75b8518a5375'),
('city_id', '59053'),
('start_month', '10'),
('start_year', '2018'),
('number_of_months', '36'),
('currency', 'native'),
('show_regions', 'true'),
)
response = requests.get('https://api.airdna.co/v1/market/property_list', headers=headers, params=params)
results = response.json()["properties"]
for result in results[0:20]:
title = result["title"]
days_available = result["days_available"]
print (f"{title} : {days_available}")
結果:
Panoramic Ocean View Studio Loft : 274
Private 1906 Bungalow : 364
Serene Garden Room by the Beach!!! : 188
Bright New Beachside Master Suite : 171
Bright New Beachside Bedroom : 164
Pvt bedroom-pvt bath & entryway. Ocean front Views : 155
Elegant Design Apartment with Courtyard Garden Dining Space : 224
Liz''s Beachy Retreat in Santa Monica! : 55
Santa Monica One BedRoom Apt.(Ocean Breeze B) : 26
ROOM & BATH. 4 BLOCKS TO OCEAN. N OF WILSHIRE. : 114
Comfy Room - Amazing Location! : 178
Steps to Beach in Gorgeous Suite! : 84
Stunning Three Bedroom Santa Monica Beach Home : 224
Santa Monica with parking/Montana close to beach : 156
PRIVATE ROOM W/BR IN SANTA MONICA : 293
Private Room with Bathroom at Beach :)Just Perfect : 334
Newly Furnished! 1 Bed Beach Condo : 45
Santa Monica Beach House!Prime area : 264
Santa Monica Canyon Pied-a-Terre : 355
Santa Monica Beach Suite 5 : 276
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/311624.html
上一篇:SeleniumWebdriver在Ruby中找不到“導航”元素
下一篇:無法獲取元素的大小和硒中的類
