DDownloader 0.1.4__py3-none-any.whl → 0.1.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/__init__.py CHANGED
@@ -1,3 +1,11 @@
1
- from .hls_downloader import HLSDownloader
2
- from .dash_downloader import DASHDownloader
3
- from .decrypt_downloader import DecryptDownloader
1
+ from .bin import *
2
+ from .dash_downloader import DASH
3
+ from .hls_downloader import HLS
4
+ from .streamlink import STREAMLINK
5
+
6
+ __all__ = [
7
+ 'DDownloader',
8
+ 'HLS',
9
+ 'STREAMLINK',
10
+ 'DASH'
11
+ ]
@@ -1,49 +1,84 @@
1
- import os
2
- import subprocess
3
- import logging
4
- import coloredlogs
5
-
6
- # Set up logging
7
- logger = logging.getLogger(__name__)
8
- coloredlogs.install(level='DEBUG', logger=logger)
9
-
10
- class DASH:
11
- def __init__(self):
12
- self.manifest_url = None
13
- self.output_name = None
14
- self.decryption_key = None
15
- self.binary_path = os.path.join(os.path.dirname(__file__), 'bin', 'N_m3u8DL-RE')
16
-
17
- def dash_downloader(self):
18
- if not self.manifest_url:
19
- logger.error("Manifest URL is not set.")
20
- return
21
-
22
- command = self._build_command()
23
-
24
- logger.debug(f"Running command: {' '.join(command)}")
25
- self._execute_command(command)
26
-
27
- def _build_command(self):
28
- command = [
29
- self.binary_path,
30
- self.manifest_url,
31
- '--auto-select',
32
- '-mt',
33
- '--thread-count', '12',
34
- '--save-dir', 'downloads',
35
- '--tmp-dir', 'downloads',
36
- '--save-name', self.output_name
37
- ]
38
- if self.decryption_key:
39
- command.append(f'--key {self.decryption_key}')
40
- return command
41
-
42
- def _execute_command(self, command):
43
- try:
44
- subprocess.run(command, check=True)
45
- logger.info("Downloaded using N_m3u8DL-RE")
46
- except subprocess.CalledProcessError as e:
47
- logger.error(f"Error during download: {e}")
48
- except FileNotFoundError:
49
- logger.error(f"Binary not found at: {self.binary_path}")
1
+ import os
2
+ import subprocess
3
+ import logging
4
+ import platform # For platform detection
5
+ import coloredlogs
6
+ from colorama import Fore
7
+
8
+ # Set up logging
9
+ logger = logging.getLogger("+ DASH + ")
10
+ coloredlogs.install(level='DEBUG', logger=logger)
11
+
12
+ class DASH:
13
+ def __init__(self):
14
+ self.manifest_url = None
15
+ self.output_name = None
16
+ self.decryption_key = None # Default to None, making it optional
17
+ self.binary_path = self._get_binary_path()
18
+
19
+ def _get_binary_path(self):
20
+ """Determine the correct binary path based on the platform."""
21
+ base_path = os.path.join(os.path.dirname(__file__), 'bin', 'N_m3u8DL-RE')
22
+
23
+ if platform.system() == 'Windows':
24
+ binary = f"{base_path}.exe"
25
+ elif platform.system() == 'Linux':
26
+ binary = base_path # Linux binaries usually have no extension
27
+ elif platform.system() == 'Darwin': # macOS
28
+ binary = base_path # Adjust if necessary for macOS-specific binaries
29
+ else:
30
+ logger.error(f"Unsupported platform: {platform.system()}")
31
+ raise OSError(f"Unsupported platform: {platform.system()}")
32
+
33
+ if not os.path.exists(binary):
34
+ logger.error(f"Binary not found: {binary}")
35
+ raise FileNotFoundError(f"Binary not found: {binary}")
36
+
37
+ return binary
38
+
39
+ def dash_downloader(self):
40
+ if not self.manifest_url:
41
+ logger.error("Manifest URL is not set.")
42
+ return
43
+
44
+ command = self._build_command()
45
+
46
+ # logger.debug(f"Running command: {command}")
47
+ self._execute_command(command)
48
+
49
+ def _build_command(self):
50
+ # Build the basic command without extra quotes
51
+ command = [
52
+ self.binary_path, # Path to the binary
53
+ self.manifest_url, # The manifest URL
54
+ '--auto-select',
55
+ '-mt',
56
+ '--thread-count', '12',
57
+ '--save-dir', 'downloads',
58
+ '--tmp-dir', 'downloads',
59
+ '--save-name', self.output_name # The output name
60
+ ]
61
+
62
+ # Only add decryption_key if it's provided
63
+ if self.decryption_key:
64
+ logger.debug(f"Decryption key provided: {self.decryption_key}")
65
+ command.append(f'--key {self.decryption_key}') # Ensure correct format: KID:KEY
66
+
67
+ # Join the command as a single string for system execution
68
+ command_str = ' '.join(command)
69
+ # logger.debug(f"Command string: {command_str}")
70
+
71
+ return command_str
72
+
73
+ def _execute_command(self, command):
74
+ try:
75
+ # Use os.system to run the command as a string
76
+ result = os.system(command)
77
+
78
+ if result == 0:
79
+ logger.info("Downloaded using N_m3u8DL-RE successfully.")
80
+ else:
81
+ logger.error(f"Download failed with result code: {result}")
82
+
83
+ except Exception as e:
84
+ logger.error(f"An unexpected error occurred: {e}")
@@ -1,49 +1,83 @@
1
- import os
2
- import subprocess
3
- import logging
4
- import coloredlogs
5
-
6
- # Set up logging
7
- logger = logging.getLogger(__name__)
8
- coloredlogs.install(level='DEBUG', logger=logger)
9
-
10
- class HLS:
11
- def __init__(self):
12
- self.manifest_url = None
13
- self.output_name = None
14
- self.decryption_key = None
15
- self.binary_path = os.path.join(os.path.dirname(__file__), 'bin', 'N_m3u8DL-RE')
16
-
17
- def hls_downloader(self):
18
- if not self.manifest_url:
19
- logger.error("Manifest URL is not set.")
20
- return
21
-
22
- command = self._build_command()
23
-
24
- logger.debug(f"Running command: {' '.join(command)}")
25
- self._execute_command(command)
26
-
27
- def _build_command(self):
28
- command = [
29
- self.binary_path,
30
- self.manifest_url,
31
- '--auto-select',
32
- '-mt',
33
- '--thread-count', '12',
34
- '--save-dir', 'downloads',
35
- '--tmp-dir', 'downloads',
36
- '--save-name', self.output_name
37
- ]
38
- if self.decryption_key:
39
- command.append(f'--key {self.decryption_key}')
40
- return command
41
-
42
- def _execute_command(self, command):
43
- try:
44
- subprocess.run(command, check=True)
45
- logger.info("Downloaded using N_m3u8DL-RE")
46
- except subprocess.CalledProcessError as e:
47
- logger.error(f"Error during download: {e}")
48
- except FileNotFoundError:
49
- logger.error(f"Binary not found at: {self.binary_path}")
1
+ import os
2
+ import subprocess
3
+ import logging
4
+ import platform # For platform detection
5
+ import coloredlogs
6
+ from colorama import Fore
7
+
8
+ # Set up logging
9
+ logger = logging.getLogger(Fore.RED + "+ HLS + ")
10
+ coloredlogs.install(level='DEBUG', logger=logger)
11
+
12
+ class HLS:
13
+ def __init__(self):
14
+ self.manifest_url = None
15
+ self.output_name = None
16
+ self.decryption_key = None # Default to None, making it optional
17
+ self.binary_path = self._get_binary_path()
18
+
19
+ def _get_binary_path(self):
20
+ """Determine the correct binary path based on the platform."""
21
+ base_path = os.path.join(os.path.dirname(__file__), 'bin', 'N_m3u8DL-RE')
22
+
23
+ if platform.system() == 'Windows':
24
+ binary = f"{base_path}.exe"
25
+ elif platform.system() == 'Linux':
26
+ binary = base_path # Linux binaries usually have no extension
27
+ elif platform.system() == 'Darwin': # macOS
28
+ binary = base_path # Adjust if necessary for macOS-specific binaries
29
+ else:
30
+ logger.error(f"Unsupported platform: {platform.system()}")
31
+ raise OSError(f"Unsupported platform: {platform.system()}")
32
+
33
+ if not os.path.exists(binary):
34
+ logger.error(f"Binary not found: {binary}")
35
+ raise FileNotFoundError(f"Binary not found: {binary}")
36
+
37
+ return binary
38
+
39
+ def hls_downloader(self):
40
+ if not self.manifest_url:
41
+ logger.error("Manifest URL is not set.")
42
+ return
43
+
44
+ command = self._build_command()
45
+
46
+ # logger.debug(f"Running command: {command}")
47
+ self._execute_command(command)
48
+
49
+ def _build_command(self):
50
+ # Build the command to pass to os.system()
51
+ command = [
52
+ self.binary_path, # Path to the binary
53
+ self.manifest_url, # Manifest URL (no need for quotes)
54
+ '--auto-select',
55
+ '-mt',
56
+ '--thread-count', '12',
57
+ '--save-dir', 'downloads',
58
+ '--tmp-dir', 'downloads',
59
+ '--save-name', self.output_name # The output name (no quotes)
60
+ ]
61
+
62
+ # Only add decryption_key if it's provided
63
+ if self.decryption_key:
64
+ command.append(f'--key {self.decryption_key}') # Ensure correct format: KID:KEY
65
+
66
+ # Join the command as a single string for system execution
67
+ command_str = ' '.join(command)
68
+ # logger.debug(f"Command string: {command_str}")
69
+
70
+ return command_str
71
+
72
+ def _execute_command(self, command):
73
+ try:
74
+ # Use os.system to run the command as a string
75
+ result = os.system(command)
76
+
77
+ if result == 0:
78
+ logger.info("Downloaded using N_m3u8DL-RE successfully.")
79
+ else:
80
+ logger.error(f"Download failed with result code: {result}")
81
+
82
+ except Exception as e:
83
+ logger.error(f"An unexpected error occurred: {e}")
@@ -0,0 +1,19 @@
1
+ import os
2
+ import subprocess
3
+ import logging
4
+ import coloredlogs
5
+ from colorama import Fore
6
+
7
+ # Set up logging
8
+ logger = logging.getLogger(Fore.RED + " + STREAMLINK + ")
9
+ coloredlogs.install(level='DEBUG', logger=logger)
10
+
11
+ class STREAMLINK:
12
+ def __init__(self):
13
+ self.url = None
14
+ self.output_name = None
15
+ self.live_url = None
16
+ self.binary_path = os.path.join(os.path.dirname(__file__), 'bin', 'streamlink')
17
+
18
+ def streamlink_restream(self):
19
+ pass
@@ -0,0 +1,56 @@
1
+ Metadata-Version: 2.1
2
+ Name: DDownloader
3
+ Version: 0.1.6
4
+ Summary: A downloader for DRM-protected content.
5
+ Home-page: https://github.com/ThatNotEasy/DDownloader
6
+ Author: ThatNotEasy
7
+ Author-email: apidotmy@proton.me
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: requests
15
+ Requires-Dist: coloredlogs
16
+ Requires-Dist: loguru
17
+ Requires-Dist: argparse
18
+
19
+ # DDownloader
20
+ - DDownloader is a Python library to download HLS and DASH manifests and decrypt media files.
21
+
22
+ # Features
23
+ - Download HLS streams using N_m3u8DL-RE.
24
+ - Download DASH manifests and segments.
25
+ - Decrypt media files using mp4decrypt.
26
+
27
+ # Installation
28
+ Use the package manager pip to install DDownloader.
29
+ ```pip install DDownloader```
30
+
31
+ # Usage
32
+
33
+ - Download DASH content using the library:
34
+
35
+ ```python
36
+ from DDownloader.dash_downloader import DASH
37
+
38
+ dash_downloader = DASH()
39
+ dash_downloader.manifest_url = "https://example.com/path/to/manifest.mpd" # Set your DASH manifest URL
40
+ dash_downloader.output_name = "output.mp4" # Set desired output name
41
+ dash_downloader.decryption_key = "12345:678910" # Set decryption key if needed
42
+ dash_downloader.dash_downloader()
43
+ ```
44
+
45
+ - Download HLS content using the library:
46
+ ```python
47
+ from DDownloader.hls_downloader import HLS
48
+
49
+ hls_downloader = HLS()
50
+ hls_downloader.manifest_url = "https://example.com/path/to/manifest.m3u8" # Set your HLS manifest URL
51
+ hls_downloader.output_name = "output.mp4" # Set desired output name
52
+ hls_downloader.decryption_key = "12345:678910" # Set decryption key if needed
53
+ hls_downloader.hls_downloader() # Call the downloader method
54
+ ```
55
+
56
+ # THIS PROJECT STILL IN DEVELOPMENT
@@ -0,0 +1,9 @@
1
+ DDownloader/__init__.py,sha256=2qcq67r0hzIQ5dYnX5c8da19aPqSYutZmwwIFdsW1JU,203
2
+ DDownloader/dash_downloader.py,sha256=8iyOwbZIoEM-AM50UX2-jBjgHjbUvBHzemVLUDe4C74,3120
3
+ DDownloader/hls_downloader.py,sha256=kOb4zh5-M6-N9zs63NCmpKoQrxjswCDAj1woH9-0TZo,3053
4
+ DDownloader/streamlink.py,sha256=F8vneSkxgGgqxRBhCHxvID-KwltpDG2QerH6QsAHuxE,506
5
+ DDownloader-0.1.6.dist-info/METADATA,sha256=AKOfG9T2o1qLSur-krUDJn4f4hnKQ5mITp9svU1scbk,1829
6
+ DDownloader-0.1.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
7
+ DDownloader-0.1.6.dist-info/entry_points.txt,sha256=1jTwDiTcHyA4otMMuIpIDnHclZ6k23GbIfKgp1zTGYw,54
8
+ DDownloader-0.1.6.dist-info/top_level.txt,sha256=INZYgY1vEHV1MIWTPXKJL8j8-ZXjWb8u4XLuU3S8umY,12
9
+ DDownloader-0.1.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.2.0)
2
+ Generator: bdist_wheel (0.45.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ ddownloader = ddownloader.main:main
Binary file
Binary file
Binary file
Binary file
@@ -1,80 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: DDownloader
3
- Version: 0.1.4
4
- Summary: A library to download HLS and DASH manifests and decrypt media files.
5
- Author: Pari Malam
6
- Author-email: shafiqsamsuri@serasi.tech
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: License :: OSI Approved :: MIT License
9
- Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3.9
11
- Description-Content-Type: text/markdown
12
- Requires-Dist: requests
13
- Requires-Dist: coloredlogs
14
-
15
- # DDownloader
16
-
17
- **DDownloader** is a Python library to download HLS and DASH manifests and decrypt media files.
18
-
19
- ## Features
20
- - Download HLS streams using `N_m3u8DL-RE`.
21
- - Download DASH manifests and segments.
22
- - Decrypt media files using `mp4decrypt`.
23
-
24
- ## Installation
25
-
26
- Use the package manager [pip](https://pypi.org/project/DDownloader/0.1.4/) to install DDownloader.
27
-
28
- ```bash
29
- pip install DDownloader==0.1.4
30
- ```
31
-
32
- ## Usage
33
-
34
- - Download DASH content using the library:
35
- ```python
36
- from DDownloader.dash_downloader import DASH
37
-
38
- dash_downloader = DASH()
39
- dash_downloader.manifest_url = "https://example.com/path/to/manifest.mpd" # Set your DASH manifest URL
40
- dash_downloader.output_name = "output.mp4" # Set desired output name
41
- dash_downloader.decryption_key = "12345:678910" # Set decryption key if needed
42
- dash_downloader.dash_downloader() # Call the downloader method
43
- ```
44
-
45
- - Download HLS content using the library:
46
- ```python
47
- from DDownloader.hls_downloader import HLS
48
-
49
- hls_downloader = HLS()
50
- hls_downloader.manifest_url = "https://example.com/path/to/manifest.m3u8" # Set your HLS manifest URL
51
- hls_downloader.output_name = "output.mp4" # Set desired output name
52
- hls_downloader.decryption_key = "12345:678910" # Set decryption key if needed
53
- hls_downloader.hls_downloader() # Call the downloader method
54
- ```
55
-
56
- - Here's a complete example demonstrating the use of all features:
57
- ```python
58
- from DDownloader.dash_downloader import DASH
59
- from DDownloader.hls_downloader import HLS
60
-
61
- def download_dash():
62
- dash_downloader = DASH()
63
- dash_downloader.manifest_url = "https://example.com/path/to/manifest.mpd" # Set your DASH manifest URL
64
- dash_downloader.output_name = "output.mp4" # Set desired output name
65
- dash_downloader.decryption_key = "12345:678910" # Set decryption key if needed
66
- dash_downloader.dash_downloader() # Call the downloader method
67
-
68
- def download_hls():
69
- hls_downloader = HLS()
70
- hls_downloader.manifest_url = "https://example.com/path/to/manifest.m3u8" # Set your HLS manifest URL
71
- hls_downloader.output_name = "output_hls" # Set desired output name
72
- hls_downloader.decryption_key = "your_decryption_key" # Set decryption key if needed
73
- hls_downloader.hls_downloader() # Call the downloader method
74
-
75
- if __name__ == "__main__":
76
- download_dash() # Download DASH content
77
- download_hls() # Download HLS content
78
- ```
79
-
80
- ## THIS PROJECT STILL IN DEVELOPMENT
@@ -1,11 +0,0 @@
1
- DDownloader/__init__.py,sha256=o3loo1Z5ZdvQYZIjgdgZarMVMIz5pHRRZ_x0IXYA6nU,135
2
- DDownloader/dash_downloader.py,sha256=Oe-IxT30xP71kOskVrzEkuvYOWRSxoDS3Jxh42MW9fk,1499
3
- DDownloader/hls_downloader.py,sha256=cvKgs1AVWpqZmD6niYI2KYWnblowayxRCFBwPEU2FOM,1497
4
- DDownloader/bin/N_m3u8DL-RE,sha256=y2vtfXq5RXYbyN-BV2QFc_jwZyZIUMKdnQMagkkaHwU,7498940
5
- DDownloader/bin/N_m3u8DL-RE.exe,sha256=AmuDJQmtIeMSfpcVLt1Hqf5CCtSgxiQ_8KYgiYSeGbk,6456320
6
- DDownloader/bin/packager-linux-x64,sha256=Ba8unvXxLVi51hW30x3A62HDKu5jLHGWU0C0PBVWBD4,9243968
7
- DDownloader/bin/packager-win-x64.exe,sha256=LlRGcuMNHTvmwv3fZ-7b3m46iLYjHVfCrSfOQ-zpyTk,5279744
8
- DDownloader-0.1.4.dist-info/METADATA,sha256=u0fV_84QXLpjmnremapTlI7xhJlYnqUWoSBvlbz8Ce4,2853
9
- DDownloader-0.1.4.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
10
- DDownloader-0.1.4.dist-info/top_level.txt,sha256=INZYgY1vEHV1MIWTPXKJL8j8-ZXjWb8u4XLuU3S8umY,12
11
- DDownloader-0.1.4.dist-info/RECORD,,