From 7d40cf6c411aee19eda3c8490e3927c50981d854 Mon Sep 17 00:00:00 2001 From: ZouJiu <1069679911@qq.com> Date: Sat, 11 Nov 2023 15:50:01 +0800 Subject: [PATCH] auto-download edgedriver window --- crawler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crawler.py b/crawler.py index 29935a4..eb942de 100644 --- a/crawler.py +++ b/crawler.py @@ -947,12 +947,15 @@ def downloaddriver(): url = "https://msedgedriver.azureedge.net/116.0.1938.62/edgedriver_win64.zip" if not os.path.exists(driverpath): ret = requests.get("https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/") + if ret.status_code!=200: + assert ret.status_code!=200 ret = BeautifulSoup(ret.content, 'html.parser') - ddl = ret.find_all('a', class_='driver-download__link') + # divall = ret.find_all('div', class_=r'common-card--lightblue') + ddl = ret.find_all('a') for k in ddl: key = k.attrs.keys() href = k.attrs['href'] - if 'href' in key and "win64" in href: + if 'href' in key and "win64" in href and ".zip" in href: url = href break response = requests.get(url)