我試圖從網站獲取一些信息,但沒有成功。如何刮取按鈕鎖定的數據?
問題是隻有在點擊某個按鈕後才顯示數據。
,我想就設在這個標籤中的信息:
<div id="frmContact" class="contactForm hidden"></div>
<div class="btn btn-secondary viewnumber phone-trigger" data-ga-action="header">
<a href="#" rel="nofollow">Ver telefone</a>
<i class="icon"></i>
</div>
它可能有一些做這一行:
<form action="/noindex/doctor-phone" id="frmPhone" method="post"><input name="__RequestVerificationToken" type="hidden" value="3uFb11EKzbTh4TWoqXk025U7jS7QoV5-od7lSgSBzdu616u82jQAHiOTl2aB3q47aRCIg2CjVCjE6R6bUAqDplAOfeM1" /><input id="entityKey" name="entityKey" type="hidden" value="12898671" /><input id="placeType" name="placeType" type="hidden" value="" /><input id="placeKey" name="placeKey" type="hidden" value="" /></form> <div id="phonePlacer"></div>
但我不知道如何正確使用這個__RequestVerificationToken
。
我一定要送request使用這種信息獲取手機信息的服務器?如果是這樣,怎麼樣?
我點擊該按鈕後,這是出現的彈出(我感興趣的INFO1到信息4):
我的代碼:
page = BeautifulSoup(urllib2.urlopen('http://www.doctoralia.com.br/medico/RANDOM_PROFILE'), "html.parser")
hidden_tags = page.find_all("input", type="hidden")
for tag in hidden_tags:
print tag
輸出:
<input name="__RequestVerificationToken" type="hidden" value="gPYstKvmi4xBQsV81ECf5mYe695igvq8E2QqtOgBPqtRybEP74OEbSAe8uDg8dlZCpqib94FIrUoPMnpLTC0tY7kiJE1"/>
<input id="entityKey" name="entityKey" type="hidden" value="14336768"/>
<input id="placeType" name="placeType" type="hidden" value=""/>
<input id="placeKey" name="placeKey" type="hidden" value=""/>
偉大的答案...簡明扼要又涵蓋了所有問題 – charlietfl