mdbq 4.0.72__py3-none-any.whl → 4.0.73__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mdbq/__version__.py CHANGED
@@ -1 +1 @@
1
- VERSION = '4.0.72'
1
+ VERSION = '4.0.73'
@@ -81,14 +81,50 @@ class GetDriver:
81
81
  """
82
82
  try:
83
83
  if platform.system().lower() == 'windows':
84
- # Windows下使用--version参数
85
- result = subprocess.run([chrome_path, '--version'],
86
- capture_output=True, text=True, timeout=10)
87
- if result.returncode == 0:
88
- # 输出格式: "Google Chrome 120.0.6099.109"
89
- version_match = re.search(r'Chrome\s+(\d+\.\d+\.\d+\.\d+)', result.stdout)
90
- if version_match:
91
- return version_match.group(1)
84
+ # Windows下尝试多种方式获取版本
85
+ # 方法1: 尝试--version参数
86
+ try:
87
+ result = subprocess.run([chrome_path, '--version'],
88
+ capture_output=True, text=True, timeout=10, shell=True)
89
+ if result.returncode == 0:
90
+ version_match = re.search(r'Chrome\s+(\d+\.\d+\.\d+\.\d+)', result.stdout)
91
+ if version_match:
92
+ return version_match.group(1)
93
+ except:
94
+ pass
95
+
96
+ # 方法2: 尝试从注册表获取版本
97
+ try:
98
+ import winreg
99
+ key_path = r"SOFTWARE\Google\Chrome\BLBeacon"
100
+ with winreg.OpenKey(winreg.HKEY_CURRENT_USER, key_path) as key:
101
+ version = winreg.QueryValueEx(key, "version")[0]
102
+ return version
103
+ except:
104
+ pass
105
+
106
+ # 方法3: 尝试从文件属性获取版本
107
+ try:
108
+ result = subprocess.run(['wmic', 'datafile', 'where', f'name="{chrome_path.replace("/", "\\")}"', 'get', 'version', '/value'],
109
+ capture_output=True, text=True, timeout=10, shell=True)
110
+ if result.returncode == 0:
111
+ version_match = re.search(r'Version=(\d+\.\d+\.\d+\.\d+)', result.stdout)
112
+ if version_match:
113
+ return version_match.group(1)
114
+ except:
115
+ pass
116
+
117
+ # 方法4: 尝试直接启动Chrome获取版本信息
118
+ try:
119
+ result = subprocess.run([chrome_path, '--headless', '--disable-gpu', '--dump-dom', 'about:version'],
120
+ capture_output=True, text=True, timeout=15, shell=True)
121
+ if result.returncode == 0:
122
+ version_match = re.search(r'Chrome/(\d+\.\d+\.\d+\.\d+)', result.stdout)
123
+ if version_match:
124
+ return version_match.group(1)
125
+ except:
126
+ pass
127
+
92
128
  else:
93
129
  # macOS和Linux下使用--version参数
94
130
  result = subprocess.run([chrome_path, '--version'],
@@ -109,8 +145,14 @@ class GetDriver:
109
145
  :return: 版本号字符串,如"120.0.6099.109"
110
146
  """
111
147
  try:
112
- result = subprocess.run([chromedriver_path, '--version'],
113
- capture_output=True, text=True, timeout=10)
148
+ if platform.system().lower() == 'windows':
149
+ # Windows下使用shell=True确保参数正确传递
150
+ result = subprocess.run([chromedriver_path, '--version'],
151
+ capture_output=True, text=True, timeout=10, shell=True)
152
+ else:
153
+ result = subprocess.run([chromedriver_path, '--version'],
154
+ capture_output=True, text=True, timeout=10)
155
+
114
156
  if result.returncode == 0:
115
157
  # 输出格式: "ChromeDriver 120.0.6099.109"
116
158
  version_match = re.search(r'ChromeDriver\s+(\d+\.\d+\.\d+\.\d+)', result.stdout)
@@ -130,8 +172,10 @@ class GetDriver:
130
172
  chrome_version = self._get_chrome_version(chrome_path)
131
173
  chromedriver_version = self._get_chromedriver_version(chromedriver_path)
132
174
 
175
+ # 如果无法获取版本信息,返回True允许尝试启动
133
176
  if not chrome_version or not chromedriver_version:
134
- return False, chrome_version, chromedriver_version
177
+ print(f"警告: 无法获取版本信息 - Chrome: {chrome_version}, Chromedriver: {chromedriver_version}")
178
+ return True, chrome_version, chromedriver_version
135
179
 
136
180
  # 提取主版本号进行比较
137
181
  chrome_major = chrome_version.split('.')[0]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mdbq
3
- Version: 4.0.72
3
+ Version: 4.0.73
4
4
  Home-page: https://pypi.org/project/mdbq
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -1,5 +1,5 @@
1
1
  mdbq/__init__.py,sha256=Il5Q9ATdX8yXqVxtP_nYqUhExzxPC_qk_WXQ_4h0exg,16
2
- mdbq/__version__.py,sha256=_hhEVsHNRe5szh4nb_dJ6z64dFjwH_wfQ3tLU7LCUX0,18
2
+ mdbq/__version__.py,sha256=v9CxLcSDpoYTepVqra_1iaKkOd7scJSGR8ITdcM5Nr4,18
3
3
  mdbq/log/__init__.py,sha256=Mpbrav0s0ifLL7lVDAuePEi1hJKiSHhxcv1byBKDl5E,15
4
4
  mdbq/log/mylogger.py,sha256=kPe3wsQNaB1slfX-Z7VMqzZoMoqPfc7ylYXZDBeFzzI,24945
5
5
  mdbq/myconf/__init__.py,sha256=jso1oHcy6cJEfa7udS_9uO5X6kZLoPBF8l3wCYmr5dM,18
@@ -22,9 +22,9 @@ mdbq/pbix/refresh_all.py,sha256=OBT9EewSZ0aRS9vL_FflVn74d4l2G00wzHiikCC4TC0,5926
22
22
  mdbq/redis/__init__.py,sha256=YtgBlVSMDphtpwYX248wGge1x-Ex_mMufz4-8W0XRmA,12
23
23
  mdbq/redis/getredis.py,sha256=vpBuNc22uj9Vr-_Dh25_wpwWM1e-072EAAIBdB_IpL0,23494
24
24
  mdbq/selenium/__init__.py,sha256=AKzeEceqZyvqn2dEDoJSzDQnbuENkJSHAlbHAD0u0ZI,10
25
- mdbq/selenium/get_driver.py,sha256=bZoE3Z2pf75r5ngDS_B9xshLiOwO--X-N5RKsQjKEQ8,19181
25
+ mdbq/selenium/get_driver.py,sha256=ppV_CJvvRu2__VIYQS-nfhW0lOlesuR11bG_d2MfmNs,21523
26
26
  mdbq/spider/__init__.py,sha256=RBMFXGy_jd1HXZhngB2T2XTvJqki8P_Fr-pBcwijnew,18
27
- mdbq-4.0.72.dist-info/METADATA,sha256=76uckGGCRbJe7W5oV3_FTdkTR28VT_RKmrDpHLWLKhQ,364
28
- mdbq-4.0.72.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
29
- mdbq-4.0.72.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
30
- mdbq-4.0.72.dist-info/RECORD,,
27
+ mdbq-4.0.73.dist-info/METADATA,sha256=i2uf1d6ZPcI60XOSOGXW6wgePbz_pHsumb0-LGJD8Ns,364
28
+ mdbq-4.0.73.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
29
+ mdbq-4.0.73.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
30
+ mdbq-4.0.73.dist-info/RECORD,,
File without changes