使用BeautifulSoup(脚本标记)提取经度和纬度

时间:2017-05-12 08:55:56

标签: python web-scraping geolocation beautifulsoup

我正试图从HTML的这一部分中提取纬度和经度(有两对纬度/经度,我需要它适用于任意数量的坐标):

<script type="text/javascript"> 
[...]
truvo.data['map']= [{"lat":50.469585,"lon":4.487113,"id":"fr_BE_YP_PAID_16758523_0000_2840991_8600_20139917392","number":"1","display":"1","customerid":"16758523","addressid":"2840991","part":"base","type":"paid"},{"lat":50.721645,"lon":4.6253505,"id":"fr_BE_YP_PAID_12075596_0000_2315340_8600_20139200640","number":"2","display":"2","customerid":"12075596","addressid":"2315340","part":"base","type":"paid"}]
;
</script>   

我尝试了几种方法:

how to access latitude and longtitude in a script with beautifulsoup?

How to scrape latitude longitude in beautiful soup

和其他所有类型的stackoverflow提案,但没有任何作用。

如果我使用某种模式,那会是正确的吗?

'("lat"|"lon"):(-?\d{1,3}\.\d+)'

有人有想法吗?

非常感谢,

玛丽

0 个答案:

没有答案