亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

網頁抓取以從嵌入的谷歌地圖鏈接中提取坐標

網頁抓取以從嵌入的谷歌地圖鏈接中提取坐標

函數式編程 2021-07-27 17:13:33
import requestsimport urllib2from bs4 import BeautifulSoupfrom pprint import pprintimport pandas as pdimport bs4url = 'https://www.namus.gov/MissingPersons/Case#/53061'page = urllib2.urlopen(url)soup = BeautifulSoup(page, 'html')#print(soup.prettify())findall = soup.find_all("a")for link in findall:    pprint(link.get("ng-href"))當我運行代碼時,我設置了一個元組而不是鏈接。我試過引用 href、src、ng-href 和 non work。當我真的需要將谷歌地圖的鏈接作為字符串時,我只能拉取 subSection。#I get this: u'{{subSection.mapLink()}}'#when I really need this: #"http://www.google.com/maps/place/35.9467011,-84.03260329999999"我嘗試抓取的實際字符串如下所示:<a ng-if="subSection.mapLink()" class="icon-text-link" ng-href="http://www.google.com/maps/place/35.9467011,-84.03260329999999" target="_blank" href="http://www.google.com/maps/place/35.9467011,-84.03260329999999">                <i class="icon-location-pin"></i><span>Map</span>            </a>
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 237 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號