1
所以我編寫了下面的程序,從這個搜索結果頁面https://www.ohiobar.org/Pages/Find-a-Lawyer.aspx?sFN=&sLN=&sPA=&sCI=&sST=OH&sZC=網絡爬蟲抓取並非所有URL
大約有18,400+鏈接提取獲取所有配置文件的URL。
但是,當我運行代碼時,它不會超出URL#1623,它會停止而不會給出任何錯誤或任何內容。
這裏是我的代碼
from bs4 import BeautifulSoup
import requests
url = 'https://www.ohiobar.org/Pages/Find-a-Lawyer.aspx?sFN=&sLN=&sPA=&sCI=&sST=OH&sZC='
with requests.Session() as session:
session.headers = {'User-Agent': 'Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30'}
response = session.get(url)
soup = BeautifulSoup(response.content, "lxml")
for link in soup.select("div#content_findResults div#content_column1 ul li a[href*=MemberProfile]"):
print 'https://www.ohiobar.org' + link.get("href")
請建議什麼,我做錯了什麼?
謝謝