DDownloader 0.2.4__py3-none-any.whl → 0.2.6__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.
DDownloader/main.py CHANGED
@@ -12,7 +12,7 @@ from DDownloader.modules.dash_downloader import DASH
12
12
  from DDownloader.modules.hls_downloader import HLS
13
13
 
14
14
  # Setup logger
15
- logger = logging.getLogger("+ MAIN + ")
15
+ logger = logging.getLogger("+ DDOWNLOADER + ")
16
16
  coloredlogs.install(level='DEBUG', logger=logger)
17
17
 
18
18
  def validate_directories():
@@ -38,12 +38,17 @@ def display_help():
38
38
  def main():
39
39
  clear_and_print()
40
40
  platform_name = detect_platform()
41
+ if platform_name == 'Unknown':
42
+ logger.error(f"Unsupported platform: {platform_name}")
43
+ exit(1)
44
+
41
45
  logger.info(f"Running on platform: {platform_name}")
42
46
  time.sleep(1)
43
47
 
44
48
  logger.info(f"Downloading binaries... Please wait!\n")
45
49
  bin_dir = Path(__file__).resolve().parent / "bin"
46
50
  download_binaries(bin_dir)
51
+
47
52
  time.sleep(1)
48
53
  logger.info(f"{Fore.GREEN}Downloading completed! Bye!{Fore.RESET}")
49
54
  clear_and_print()
@@ -19,7 +19,7 @@ def banners():
19
19
  stdout.write(""+Fore.YELLOW +"╔════════════════════════════════════════════════════════════════════════════╝\n")
20
20
  stdout.write(""+Fore.YELLOW +"║ \x1b[38;2;255;20;147m• "+Fore.GREEN+"GITHUB "+Fore.RED+" |"+Fore.LIGHTWHITE_EX+" GITHUB.COM/THATNOTEASY "+Fore.YELLOW+"║\n")
21
21
  stdout.write(""+Fore.YELLOW +"╚════════════════════════════════════════════════════════════════════════════╝\n")
22
- print(f"{Fore.YELLOW}[DDownloader] - {Fore.GREEN}Download DASH or HLS streams with decryption keys. - {Fore.RED}[V0.2.4] \n{Fore.RESET}")
22
+ print(f"{Fore.YELLOW}[DDownloader] - {Fore.GREEN}Download DASH or HLS streams with decryption keys. - {Fore.RED}[V0.2.6] \n{Fore.RESET}")
23
23
 
24
24
  def clear_and_print():
25
25
  time.sleep(1)
@@ -1,36 +1,55 @@
1
1
  import os
2
2
  import requests
3
3
  from tqdm import tqdm
4
- from colorama import Fore
4
+ from colorama import Fore, Style, init
5
5
  import logging
6
6
  import coloredlogs
7
7
  import platform
8
8
 
9
+ # Initialize Colorama for Windows compatibility
10
+ init(autoreset=True)
11
+
12
+ # Logger setup
9
13
  logger = logging.getLogger(Fore.GREEN + "+ HELPER + ")
10
14
  coloredlogs.install(level='DEBUG', logger=logger)
11
15
 
12
- binaries = [
13
- "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/N_m3u8DL-RE",
14
- "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/N_m3u8DL-RE.exe",
15
- "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/ffmpeg.exe",
16
- "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/aria2c.exe",
17
- "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/mp4decrypt.exe",
18
- "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/shaka-packager.exe",
19
- "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/yt-dlp.exe",
20
- "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/mkvmerge.exe"
21
- ]
16
+ # Binaries with platform-specific handling
17
+ binaries = {
18
+ "Windows": [
19
+ "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/N_m3u8DL-RE.exe",
20
+ "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/ffmpeg.exe",
21
+ "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/aria2c.exe",
22
+ "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/mp4decrypt.exe",
23
+ "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/shaka-packager.exe",
24
+ "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/yt-dlp.exe",
25
+ "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/mkvmerge.exe"
26
+ ],
27
+ "Linux": [
28
+ "https://github.com/ThatNotEasy/DDownloader/raw/refs/heads/main/DDownloader/bin/N_m3u8DL-RE"
29
+ ]
30
+ }
22
31
 
23
- def download_binaries(bin_dir):
32
+ def download_binaries(bin_dir, platform_name):
33
+ """
34
+ Downloads platform-specific binaries to the specified directory.
35
+ """
24
36
  os.makedirs(bin_dir, exist_ok=True)
25
- # logger.info(f"Created or confirmed directory: {bin_dir}")
37
+ logger.info(f"Platform detected: {platform_name}")
38
+ logger.info(f"Using binary directory: {bin_dir}")
39
+
40
+ platform_binaries = binaries.get(platform_name, [])
41
+
42
+ if not platform_binaries:
43
+ logger.error(f"No binaries available for platform: {platform_name}")
44
+ return
26
45
 
27
- for binary_url in binaries:
46
+ for binary_url in platform_binaries:
28
47
  try:
29
48
  filename = binary_url.split("/")[-1]
30
49
  filepath = os.path.join(bin_dir, filename)
31
50
 
32
51
  if os.path.exists(filepath):
33
- logger.info(f"Skipping {filename} (already exists).")
52
+ logger.info(f"{Style.BRIGHT}{Fore.YELLOW}Skipping {filename} (already exists).")
34
53
  continue
35
54
 
36
55
  logger.info(f"{Fore.GREEN}Downloading {Fore.WHITE}{filename}...{Fore.RESET}")
@@ -52,12 +71,18 @@ def download_binaries(bin_dir):
52
71
  progress_bar.update(len(chunk))
53
72
 
54
73
  # logger.info(f"{Fore.GREEN}Downloaded and saved: {filepath}{Fore.RESET}")
74
+ # Make binary executable on Linux
75
+ if platform_name == "Linux":
76
+ os.chmod(filepath, 0o755)
55
77
  except requests.exceptions.RequestException as e:
56
78
  logger.error(f"{Fore.RED}Failed to download {binary_url}: {e}{Fore.RESET}")
57
79
  except Exception as e:
58
80
  logger.error(f"{Fore.RED}Unexpected error for {binary_url}: {e}{Fore.RESET}")
59
81
 
60
82
  def detect_platform():
83
+ """
84
+ Detects the current operating system platform.
85
+ """
61
86
  system_platform = platform.system().lower()
62
87
  if system_platform == 'windows':
63
88
  return 'Windows'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: DDownloader
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: A downloader for DRM-protected content.
5
5
  Author-email: ThatNotEasy <apidotmy@proton.me>
6
6
  License: MIT License
@@ -34,6 +34,8 @@ Description-Content-Type: text/markdown
34
34
  License-File: LICENSE
35
35
  Requires-Dist: requests>=2.26.0
36
36
  Requires-Dist: coloredlogs>=15.0
37
+ Requires-Dist: tqdm>=4.64.0
38
+ Requires-Dist: colorama>=0.4.5
37
39
  Requires-Dist: loguru>=0.6.0
38
40
 
39
41
  # DDownloader
@@ -44,6 +46,9 @@ Requires-Dist: loguru>=0.6.0
44
46
  - Download DASH manifests and segments.
45
47
  - Decrypt media files using mp4decrypt.
46
48
 
49
+ # Footprints Notes:
50
+ - It is better if you have set your own environment variables.
51
+
47
52
  # Installation
48
53
  Use the package manager pip to install DDownloader.
49
54
  ```pip install DDownloader```
@@ -1,15 +1,15 @@
1
1
  DDownloader/__init__.py,sha256=lVZwmZNId0Dai7XBQpxglmJtIxAtZplRHDsvobL2UNo,33
2
- DDownloader/main.py,sha256=rUk09-SwBMpUK4_ybtkwamexjuOTaxBPwp4b6e-57Lc,3570
2
+ DDownloader/main.py,sha256=tzBOATpwdBWEM__S805UaibUiE5gGhAgjH5joCvAJZs,3710
3
3
  DDownloader/modules/__init__.py,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
4
4
  DDownloader/modules/args_parser.py,sha256=JsmemrQcxBSz8aWHWTpAO6I4BfGoK6GmJvJFuhRhZ7Y,919
5
- DDownloader/modules/banners.py,sha256=fE1mutha7K2NzdPB5LyiVGeJd4IPpooYjFo_hhN5o2o,4059
5
+ DDownloader/modules/banners.py,sha256=JlONxRm-pNICA_hNhVEtltU9ZZMJ0q2K7eLfeyfJFA4,4059
6
6
  DDownloader/modules/dash_downloader.py,sha256=EJhNl7hRSO085ra2c9y5UdDL3x67Nb1VtDeO4svmn0I,3766
7
- DDownloader/modules/helper.py,sha256=98_Qc9pD_GK-KJHuN0zvC2eyVk3rBOSmqL8H-rsxIq8,3004
7
+ DDownloader/modules/helper.py,sha256=zmJxs0dX72vWaYDKTWUy1KxiTcGQ4zJa6ZUz5RVz3NA,3811
8
8
  DDownloader/modules/hls_downloader.py,sha256=e-PdWdgi0msVcxBPOJl8xmPpRS2ItBX4AAkZpgtGw1M,3761
9
9
  DDownloader/modules/streamlink.py,sha256=F8vneSkxgGgqxRBhCHxvID-KwltpDG2QerH6QsAHuxE,506
10
- DDownloader-0.2.4.dist-info/LICENSE,sha256=cnjTim3BMjb9cVC_b3oS41FESKLuvuDsufVHa_ymZRw,1090
11
- DDownloader-0.2.4.dist-info/METADATA,sha256=AWukqgZSEXJLWGa_H4OiPAh1R-sdnAO-eWNp_SpX2_E,3402
12
- DDownloader-0.2.4.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
13
- DDownloader-0.2.4.dist-info/entry_points.txt,sha256=tCZVr_SRONlWlMFsVKgcPj3lxe9gBtWD4GuWukMv75g,54
14
- DDownloader-0.2.4.dist-info/top_level.txt,sha256=INZYgY1vEHV1MIWTPXKJL8j8-ZXjWb8u4XLuU3S8umY,12
15
- DDownloader-0.2.4.dist-info/RECORD,,
10
+ DDownloader-0.2.6.dist-info/LICENSE,sha256=cnjTim3BMjb9cVC_b3oS41FESKLuvuDsufVHa_ymZRw,1090
11
+ DDownloader-0.2.6.dist-info/METADATA,sha256=b2CfrOROw7QyvRuErLQQy7I4YSWR9wxf_5EHBZUFmOA,3550
12
+ DDownloader-0.2.6.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
13
+ DDownloader-0.2.6.dist-info/entry_points.txt,sha256=tCZVr_SRONlWlMFsVKgcPj3lxe9gBtWD4GuWukMv75g,54
14
+ DDownloader-0.2.6.dist-info/top_level.txt,sha256=INZYgY1vEHV1MIWTPXKJL8j8-ZXjWb8u4XLuU3S8umY,12
15
+ DDownloader-0.2.6.dist-info/RECORD,,