Python PhantomJS 爬虫 示例

from selenium import webdriver
# 请求url url
= "https://auctions.freemansauction.com/auction-lot-detail/A%2Dplatinum%2Dand%2Ddiamond%2Dlorgnette%2C/1593+++++++2+/++989817" mydriver = webdriver.PhantomJS()
try:
mydriver.get(url)
result = mydriver.page_source.encode('utf8')
except:
result = mydriver.get(url)
if 'language="javascript">setTimeout' in result:
result = mydriver.get(url)
result_repalce = replace(result)

item_desc = re.findall('<div class="lot_detail_description">(.*?)</div><hr>',result_repalce)[0]
estimate_price = re.findall('<br> <b>Estimate(.*?)</b><br><br>',result_repalce)[0]

print item_desc
print estimate_price 

原文地址:https://www.cnblogs.com/xuchunlin/p/6774476.html