Home > OS >  Parse Airdna map hover over text using Selenium & Beautifulsoup
Parse Airdna map hover over text using Selenium & Beautifulsoup

Time:10-07

I'm trying to scrape data from a window which appear when hovering over a marker in map view and scrape the "Days Available" value from the window.

enter image description here

Right-click and then copy curl and then translate the command into python using this enter image description here

Your code will be like following:

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}")
 

Result:

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
  • Related