abstract-webtools 0.1.6.114__py3-none-any.whl → 0.1.6.116__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.
@@ -32,6 +32,16 @@ class K2SDownloader:
32
32
  options = webdriver.ChromeOptions()
33
33
  options.add_argument("--disable-blink-features=AutomationControlled")
34
34
  options.add_argument("--headless")
35
+
36
+ # Configure download preferences
37
+ prefs = {
38
+ "download.default_directory": self.download_dir, # Set custom download directory
39
+ "download.prompt_for_download": False, # Disable download prompt
40
+ "download.directory_upgrade": True, # Allow directory override
41
+ "safebrowsing.enabled": True # Enable safe browsing
42
+ }
43
+ options.add_experimental_option("prefs", prefs)
44
+
35
45
  return webdriver.Chrome(options=options)
36
46
 
37
47
  def login(self):
@@ -58,10 +68,10 @@ class K2SDownloader:
58
68
  # with open('login_error.html', 'w', encoding='utf-8') as f:
59
69
  # f.write(self.driver.page_source)
60
70
 
61
- def download_file(self, url):
71
+ def download_file(self, url,download_dir=None):
62
72
  if not self.logged_in:
63
73
  self.login()
64
-
74
+ download_dir = download_dir or self.download_dir
65
75
  print(f"Navigating to: {url}")
66
76
  self.driver.get(url)
67
77
  time.sleep(5)
@@ -80,7 +90,7 @@ class K2SDownloader:
80
90
  if download_url:
81
91
  response = self.session.get(download_url, stream=True)
82
92
  file_name = self._extract_filename(response, download_url)
83
- file_path = os.path.join(self.download_dir, file_name)
93
+ file_path = os.path.join(download_dir, file_name)
84
94
  if not os.path.isfile(file_path):
85
95
  with open(file_path, 'wb') as f:
86
96
  for chunk in response.iter_content(chunk_size=8192):
@@ -119,6 +129,7 @@ class dlsManager:
119
129
  def __init__(self, downloader):
120
130
  self.downloader = downloader
121
131
  self.json_file_path = self.downloader.json_file_path
132
+ self.download_dir = self.downloader.download_dir
122
133
  all_dls= None
123
134
  if self.json_file_path:
124
135
  all_dls = safe_read_from_json(self.json_file_path)
@@ -134,7 +145,7 @@ class dlsManager:
134
145
  def dl_k2s_link(self, k2s_link):
135
146
  if k2s_link:
136
147
  print(f"Downloading: {k2s_link}")
137
- self.downloader.download_file(k2s_link)
148
+ self.downloader.download_file(k2s_link,self.download_dir)
138
149
  time.sleep(10)
139
150
  if self.json_file_path:
140
151
  self.all_dls.append(self.last_data)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: abstract_webtools
3
- Version: 0.1.6.114
3
+ Version: 0.1.6.116
4
4
  Summary: Abstract Web Tools is a Python package that provides various utility functions for web scraping tasks. It is built on top of popular libraries such as `requests`, `BeautifulSoup`, and `urllib3` to simplify the process of fetching and parsing web content.
5
5
  Home-page: https://github.com/AbstractEndeavors/abstract_essentials/tree/main/abstract_webtools
6
6
  Author: putkoff
@@ -6,7 +6,7 @@ abstract_webtools/big_user_agent_list.py,sha256=5ZkrUWmfzYL5yaULREslh9ZiRQeITbSj
6
6
  abstract_webtools/domain_identifier.py,sha256=AvWlGD7C19rySa_J_Brxi3kz43LMWvGsshuuZNg7MvI,3320
7
7
  abstract_webtools/extention_list.py,sha256=gRSO4nMbuuXDYzd-ss4s64sS80ZHmUoazMCpgoKG5vE,4884
8
8
  abstract_webtools/find_dirs.py,sha256=BlE4ruzMABqmv03NcutZ1j5N3pCc-Q4uNEAMpNolZCQ,2609
9
- abstract_webtools/k2s_downloader.py,sha256=viIph191079tzvcNSyaU6urMTOraM_hKAJr-IFqGoSA,6347
9
+ abstract_webtools/k2s_downloader.py,sha256=t0tCKAfDNQGn9tKh3eg0XVU0bY-MmYITwJa3ANf7090,6988
10
10
  abstract_webtools/main.py,sha256=_I7pPXPkoLZOoYGLQDrSLGhGuQt6-PVyXEHZSmglk2g,1329
11
11
  abstract_webtools/soup_gui.py,sha256=n95YAps1R6DpMwR4UbthSqQby0C5WHUa9tsW-f2qpLg,5184
12
12
  abstract_webtools/url_grabber.py,sha256=pnCCev7ZIuM-6cAGTLmK5HfzZg_AX-fLcRpB6ZE70B8,10441
@@ -42,7 +42,7 @@ abstract_webtools/managers/soupManager/soupManager.py,sha256=U3_o189-OWoBRaSCe2s
42
42
  abstract_webtools/managers/urlManager/__init__.py,sha256=gaJCHeK91Z-eYsBnxgdhbIUten1-gbx-zqx70R6ag-Y,26
43
43
  abstract_webtools/managers/urlManager/urlManager.py,sha256=vCFuLADmv3h7icaaoAsImGqb_49VizPY_ZvMl-C7PYk,7756
44
44
  abstract_webtools/managers/videos/Heather brooke swallo from condom.mp4,sha256=h-bKFLAHt7pGLGu4EcMvSSox7BPRK0Nga3u813iMVKQ,8335544
45
- abstract_webtools-0.1.6.114.dist-info/METADATA,sha256=AAnYixHMOZzzvNgKnS3PMThbx-ifcswcYAZl9qyAlho,7289
46
- abstract_webtools-0.1.6.114.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
47
- abstract_webtools-0.1.6.114.dist-info/top_level.txt,sha256=2DMJ7RmjTcjCsa-uwAV0K6eXXlIIkFDEjBLg_uyCmCI,18
48
- abstract_webtools-0.1.6.114.dist-info/RECORD,,
45
+ abstract_webtools-0.1.6.116.dist-info/METADATA,sha256=Rc7MzFwG0N8HGWF59zbh50WiFWUJ_CQ-h3E76KcLJmY,7289
46
+ abstract_webtools-0.1.6.116.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
47
+ abstract_webtools-0.1.6.116.dist-info/top_level.txt,sha256=2DMJ7RmjTcjCsa-uwAV0K6eXXlIIkFDEjBLg_uyCmCI,18
48
+ abstract_webtools-0.1.6.116.dist-info/RECORD,,