junshan-kit 2.1.9__py2.py3-none-any.whl → 2.2.0__py2.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.
junshan_kit/meta.py CHANGED
@@ -202,17 +202,21 @@ class JianguoyunDownloaderFirefox:
202
202
  print("❌ Failed to find or click the download button:", e)
203
203
  raise
204
204
 
205
-
206
205
  def wait_for_download(self, timeout=3600):
206
+ """Wait until all downloads are finished (auto-detects browser type)."""
207
207
  print("⏳ Waiting for downloads to finish...")
208
208
  start_time = time.time()
209
+
210
+ # Determine the temporary file extension based on the browser type
211
+ temp_ext = ".crdownload" if "chrome" in self.driver.capabilities["browserName"].lower() else ".part"
212
+
209
213
  while time.time() - start_time < timeout:
210
- files = os.listdir(self.download_path)
211
- if any(not f.endswith(".part") for f in files):
214
+ downloading = [f for f in os.listdir(self.download_path) if f.endswith(temp_ext)]
215
+ if not downloading:
212
216
  print("✅ Download completed!")
213
- return
214
- time.sleep(5)
215
- print("⚠️ Timeout: download not completed within 1 hour")
217
+ return True
218
+ time.sleep(2)
219
+
216
220
 
217
221
  def close(self):
218
222
  print("🛑 Closing browser...")
@@ -235,14 +239,14 @@ class JianguoyunDownloaderFirefox:
235
239
  # MAIN
236
240
  # =============================================================
237
241
 
238
- # if __name__ == "__main__":
239
- # url = "https://www.jianguoyun.com/p/DdyHJxUQqdHDDRjvtI0GIAA"
242
+ if __name__ == "__main__":
243
+ url = "https://www.jianguoyun.com/p/DdyHJxUQqdHDDRjvtI0GIAA"
240
244
 
241
- # use_chrome = True # Set True to use Chrome, False for Firefox
245
+ use_chrome = True # Set True to use Chrome, False for Firefox
242
246
 
243
- # if use_chrome:
244
- # downloader = JianguoyunDownloaderChrome(url)
245
- # else:
246
- # downloader = JianguoyunDownloaderFirefox(url)
247
+ if use_chrome:
248
+ downloader = JianguoyunDownloaderChrome(url)
249
+ else:
250
+ downloader = JianguoyunDownloaderFirefox(url)
247
251
 
248
- # downloader.run()
252
+ downloader.run()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: junshan_kit
3
- Version: 2.1.9
3
+ Version: 2.2.0
4
4
  Summary: This is an optimization tool.
5
5
  Author-email: Junshan Yin <junshanyin@163.com>
6
6
  Requires-Dist: kaggle==1.7.4.5
@@ -1,8 +1,8 @@
1
1
  junshan_kit/DataProcessor.py,sha256=AW_1jROexC3s41-RgzqzYVwPI0sOf3tzjiph4qa_Vcw,3882
2
2
  junshan_kit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  junshan_kit/datahub.py,sha256=I34e26psFS8WK4X6SNucKPLtdBm0Ujzqa0VDIRACah4,5163
4
- junshan_kit/meta.py,sha256=wzctYAckD3Gex1MMK5J6diV5z66E_rDUb814NzBQ5VY,9816
4
+ junshan_kit/meta.py,sha256=5aHyUPVr3P3yoAdC4DzOZv4AtaO9iX8zGjluwpOly6Q,10017
5
5
  junshan_kit/test.py,sha256=uSckjcr_Wgj__YPTwD6x0GY8Hfn5GBEXIpRf9vIYBbU,91
6
- junshan_kit-2.1.9.dist-info/METADATA,sha256=AjGMtbds79-V-BRJoU-vx0_PYNy9tJ380zOKlI8bOPs,329
7
- junshan_kit-2.1.9.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
8
- junshan_kit-2.1.9.dist-info/RECORD,,
6
+ junshan_kit-2.2.0.dist-info/METADATA,sha256=aWDiR4w_Z7sVVrLcqjQNYgt3L-iFWSydzcoiUPqDsg8,329
7
+ junshan_kit-2.2.0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
8
+ junshan_kit-2.2.0.dist-info/RECORD,,