Web Scrape 交互式地图坐标

Web Scrape interactive map coordinates

我正在为如何从网站上抓取交互式地图或坐标而苦恼,

下面是我想用 requests/bs4 抓取的地图(或坐标)示例。

我们的想法是抓取大约 100 个地图位置并将它们绘制成地图。

请问如何抓取网站地图底部:

https://www.njuskalo.hr/nekretnine/gradevinsko-zemljiste-zagreb-lucko-5000-m2-oglas-34732559

位置数据隐藏在HTML内的脚本标签中,您可以这样取出:

import requests
import json

headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36'}

url = 'https://www.njuskalo.hr/nekretnine/gradevinsko-zemljiste-zagreb-lucko-5000-m2-oglas-34732559'
resp = requests.get(url,headers=headers)

start = '"defaultMarker":'
end = ',"cluster":{"icon1'

s = resp.text
dirty_json = s[s.find(start)+len(start):s.rfind(end)].strip() #get the json out the html
clean_json = json.loads(dirty_json)

print(clean_json['lat'],clean_json['lng'])