DDownloader 0.2.3__py3-none-any.whl → 0.2.5__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
@@ -7,12 +7,12 @@ from pathlib import Path
7
7
  from colorama import Fore, Style
8
8
  from DDownloader.modules.helper import download_binaries, detect_platform
9
9
  from DDownloader.modules.args_parser import parse_arguments
10
- from DDownloader.modules.banners import banners
10
+ from DDownloader.modules.banners import clear_and_print
11
11
  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():
@@ -36,18 +36,22 @@ def display_help():
36
36
  )
37
37
 
38
38
  def main():
39
- banners()
40
- time.sleep(1)
39
+ clear_and_print()
41
40
  platform_name = detect_platform()
41
+ if platform_name == 'Unknown':
42
+ logger.error(f"Unsupported platform: {platform_name}")
43
+ exit(1)
44
+
42
45
  logger.info(f"Running on platform: {platform_name}")
43
46
  time.sleep(1)
44
47
 
45
- logger.info(f"Downloading binaries... Please wait!")
48
+ logger.info(f"Downloading binaries... Please wait!\n")
46
49
  bin_dir = Path(__file__).resolve().parent / "bin"
47
50
  download_binaries(bin_dir)
48
- logger.info(f"{Fore.GREEN}Downloading completed! Bye!{Fore.RESET}")
51
+
49
52
  time.sleep(1)
50
- banners()
53
+ logger.info(f"{Fore.GREEN}Downloading completed! Bye!{Fore.RESET}")
54
+ clear_and_print()
51
55
 
52
56
  validate_directories()
53
57
  try:
@@ -1,4 +1,4 @@
1
- import os
1
+ import os, time
2
2
  from sys import stdout
3
3
  from colorama import Fore, Style
4
4
 
@@ -6,7 +6,6 @@ def clear_screen():
6
6
  os.system('cls' if os.name == 'nt' else 'clear')
7
7
 
8
8
  def banners():
9
- clear_screen()
10
9
  stdout.write(" \n")
11
10
  stdout.write(""+Fore.LIGHTRED_EX +"██████╗ ██████╗ ██████╗ ██╗ ██╗███╗ ██╗██╗ ██████╗ █████╗ ██████╗ █████╗ ███████╗██████╗ \n")
12
11
  stdout.write(""+Fore.LIGHTRED_EX +"██╔══██╗██╔══██╗██╔═══██╗██║ ██║████╗ ██║██║ ██╔═══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗\n")
@@ -20,7 +19,12 @@ def banners():
20
19
  stdout.write(""+Fore.YELLOW +"╔════════════════════════════════════════════════════════════════════════════╝\n")
21
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")
22
21
  stdout.write(""+Fore.YELLOW +"╚════════════════════════════════════════════════════════════════════════════╝\n")
23
- print(f"{Fore.YELLOW}[DDownloader] - {Fore.GREEN}Download DASH or HLS streams with decryption keys. - {Fore.RED}[V0.2.3] \n{Fore.RESET}")
22
+ print(f"{Fore.YELLOW}[DDownloader] - {Fore.GREEN}Download DASH or HLS streams with decryption keys. - {Fore.RED}[V0.2.5] \n{Fore.RESET}")
23
+
24
+ def clear_and_print():
25
+ time.sleep(1)
26
+ clear_screen()
27
+ banners()
24
28
 
25
29
 
26
30
 
@@ -1,39 +1,58 @@
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-dl.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
- logger.info(f"Downloading {filename} from {binary_url}...")
55
+ logger.info(f"{Fore.GREEN}Downloading {Fore.WHITE}{filename}...{Fore.RESET}")
37
56
  response = requests.get(binary_url, stream=True, timeout=30)
38
57
  response.raise_for_status()
39
58
 
@@ -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.3
3
+ Version: 0.2.5
4
4
  Summary: A downloader for DRM-protected content.
5
5
  Author-email: ThatNotEasy <apidotmy@proton.me>
6
6
  License: MIT License
@@ -44,6 +44,9 @@ Requires-Dist: loguru>=0.6.0
44
44
  - Download DASH manifests and segments.
45
45
  - Decrypt media files using mp4decrypt.
46
46
 
47
+ # Footprints Notes:
48
+ - It is better if you have set your own environment variables.
49
+
47
50
  # Installation
48
51
  Use the package manager pip to install DDownloader.
49
52
  ```pip install DDownloader```
@@ -1,15 +1,15 @@
1
1
  DDownloader/__init__.py,sha256=lVZwmZNId0Dai7XBQpxglmJtIxAtZplRHDsvobL2UNo,33
2
- DDownloader/main.py,sha256=6nCcnznPLmo4TTz2plg1mNtsx7-osuutOXdls6cJ1nI,3563
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=_ZxH7nIyQhTV7iSW5lVsjN8BWKbDR_wMo8FZzCSw3nA,3989
5
+ DDownloader/modules/banners.py,sha256=S_MNMWv2xPRWt-B1OYeCmy_sAW6466qPe9g1Ahotxzo,4059
6
6
  DDownloader/modules/dash_downloader.py,sha256=EJhNl7hRSO085ra2c9y5UdDL3x67Nb1VtDeO4svmn0I,3766
7
- DDownloader/modules/helper.py,sha256=DnyQa4HNlhatTOcq8tj6l6bhvql9d9bbaxn3wI4_KHo,2983
7
+ DDownloader/modules/helper.py,sha256=EIhvwpy8xFt5-SjY_G0iuMO1TYm_5LNTv6zXoyJyOrQ,3809
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.3.dist-info/LICENSE,sha256=cnjTim3BMjb9cVC_b3oS41FESKLuvuDsufVHa_ymZRw,1090
11
- DDownloader-0.2.3.dist-info/METADATA,sha256=nrlEMfyUJDFAyZycHjYpfr_22-Bid55UCJFOXXdbpDg,3402
12
- DDownloader-0.2.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
13
- DDownloader-0.2.3.dist-info/entry_points.txt,sha256=tCZVr_SRONlWlMFsVKgcPj3lxe9gBtWD4GuWukMv75g,54
14
- DDownloader-0.2.3.dist-info/top_level.txt,sha256=INZYgY1vEHV1MIWTPXKJL8j8-ZXjWb8u4XLuU3S8umY,12
15
- DDownloader-0.2.3.dist-info/RECORD,,
10
+ DDownloader-0.2.5.dist-info/LICENSE,sha256=cnjTim3BMjb9cVC_b3oS41FESKLuvuDsufVHa_ymZRw,1090
11
+ DDownloader-0.2.5.dist-info/METADATA,sha256=Mmv636Iu54PRUH3rmNx0xbhGLYJ6b4xfkTVJDhps2YM,3489
12
+ DDownloader-0.2.5.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
13
+ DDownloader-0.2.5.dist-info/entry_points.txt,sha256=tCZVr_SRONlWlMFsVKgcPj3lxe9gBtWD4GuWukMv75g,54
14
+ DDownloader-0.2.5.dist-info/top_level.txt,sha256=INZYgY1vEHV1MIWTPXKJL8j8-ZXjWb8u4XLuU3S8umY,12
15
+ DDownloader-0.2.5.dist-info/RECORD,,