DDownloader 0.1.3__tar.gz → 0.1.5__tar.gz

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.
@@ -0,0 +1,11 @@
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
+ ]
@@ -0,0 +1,84 @@
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}")
@@ -0,0 +1,83 @@
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,52 @@
1
+ Metadata-Version: 2.1
2
+ Name: DDownloader
3
+ Version: 0.1.5
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
+
15
+ # DDownloader
16
+ - DDownloader is a Python library to download HLS and DASH manifests and decrypt media files.
17
+
18
+ # Features
19
+ - Download HLS streams using N_m3u8DL-RE.
20
+ - Download DASH manifests and segments.
21
+ - Decrypt media files using mp4decrypt.
22
+
23
+ # Installation
24
+ Use the package manager pip to install DDownloader.
25
+ ```pip install DDownloader==0.1.4```
26
+
27
+ # Usage
28
+
29
+ - Download DASH content using the library:
30
+
31
+ ```python
32
+ from DDownloader.dash_downloader import DASH
33
+
34
+ dash_downloader = DASH()
35
+ dash_downloader.manifest_url = "https://example.com/path/to/manifest.mpd" # Set your DASH manifest URL
36
+ dash_downloader.output_name = "output.mp4" # Set desired output name
37
+ dash_downloader.decryption_key = "12345:678910" # Set decryption key if needed
38
+ dash_downloader.dash_downloader()
39
+ ```
40
+
41
+ - Download HLS content using the library:
42
+ ```python
43
+ from DDownloader.hls_downloader import HLS
44
+
45
+ hls_downloader = HLS()
46
+ hls_downloader.manifest_url = "https://example.com/path/to/manifest.m3u8" # Set your HLS manifest URL
47
+ hls_downloader.output_name = "output.mp4" # Set desired output name
48
+ hls_downloader.decryption_key = "12345:678910" # Set decryption key if needed
49
+ hls_downloader.hls_downloader() # Call the downloader method
50
+ ```
51
+
52
+ # THIS PROJECT STILL IN DEVELOPMENT
@@ -2,10 +2,11 @@ README.md
2
2
  setup.py
3
3
  DDownloader/__init__.py
4
4
  DDownloader/dash_downloader.py
5
- DDownloader/decrypt_downloader.py
6
5
  DDownloader/hls_downloader.py
6
+ DDownloader/streamlink.py
7
7
  DDownloader.egg-info/PKG-INFO
8
8
  DDownloader.egg-info/SOURCES.txt
9
9
  DDownloader.egg-info/dependency_links.txt
10
+ DDownloader.egg-info/entry_points.txt
10
11
  DDownloader.egg-info/requires.txt
11
12
  DDownloader.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ ddownloader = ddownloader.main:main
@@ -0,0 +1,4 @@
1
+ requests
2
+ coloredlogs
3
+ loguru
4
+ argparse
@@ -0,0 +1,52 @@
1
+ Metadata-Version: 2.1
2
+ Name: DDownloader
3
+ Version: 0.1.5
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
+
15
+ # DDownloader
16
+ - DDownloader is a Python library to download HLS and DASH manifests and decrypt media files.
17
+
18
+ # Features
19
+ - Download HLS streams using N_m3u8DL-RE.
20
+ - Download DASH manifests and segments.
21
+ - Decrypt media files using mp4decrypt.
22
+
23
+ # Installation
24
+ Use the package manager pip to install DDownloader.
25
+ ```pip install DDownloader==0.1.4```
26
+
27
+ # Usage
28
+
29
+ - Download DASH content using the library:
30
+
31
+ ```python
32
+ from DDownloader.dash_downloader import DASH
33
+
34
+ dash_downloader = DASH()
35
+ dash_downloader.manifest_url = "https://example.com/path/to/manifest.mpd" # Set your DASH manifest URL
36
+ dash_downloader.output_name = "output.mp4" # Set desired output name
37
+ dash_downloader.decryption_key = "12345:678910" # Set decryption key if needed
38
+ dash_downloader.dash_downloader()
39
+ ```
40
+
41
+ - Download HLS content using the library:
42
+ ```python
43
+ from DDownloader.hls_downloader import HLS
44
+
45
+ hls_downloader = HLS()
46
+ hls_downloader.manifest_url = "https://example.com/path/to/manifest.m3u8" # Set your HLS manifest URL
47
+ hls_downloader.output_name = "output.mp4" # Set desired output name
48
+ hls_downloader.decryption_key = "12345:678910" # Set decryption key if needed
49
+ hls_downloader.hls_downloader() # Call the downloader method
50
+ ```
51
+
52
+ # THIS PROJECT STILL IN DEVELOPMENT
@@ -0,0 +1,38 @@
1
+ # DDownloader
2
+ - DDownloader is a Python library to download HLS and DASH manifests and decrypt media files.
3
+
4
+ # Features
5
+ - Download HLS streams using N_m3u8DL-RE.
6
+ - Download DASH manifests and segments.
7
+ - Decrypt media files using mp4decrypt.
8
+
9
+ # Installation
10
+ Use the package manager pip to install DDownloader.
11
+ ```pip install DDownloader==0.1.4```
12
+
13
+ # Usage
14
+
15
+ - Download DASH content using the library:
16
+
17
+ ```python
18
+ from DDownloader.dash_downloader import DASH
19
+
20
+ dash_downloader = DASH()
21
+ dash_downloader.manifest_url = "https://example.com/path/to/manifest.mpd" # Set your DASH manifest URL
22
+ dash_downloader.output_name = "output.mp4" # Set desired output name
23
+ dash_downloader.decryption_key = "12345:678910" # Set decryption key if needed
24
+ dash_downloader.dash_downloader()
25
+ ```
26
+
27
+ - Download HLS content using the library:
28
+ ```python
29
+ from DDownloader.hls_downloader import HLS
30
+
31
+ hls_downloader = HLS()
32
+ hls_downloader.manifest_url = "https://example.com/path/to/manifest.m3u8" # Set your HLS manifest URL
33
+ hls_downloader.output_name = "output.mp4" # Set desired output name
34
+ hls_downloader.decryption_key = "12345:678910" # Set decryption key if needed
35
+ hls_downloader.hls_downloader() # Call the downloader method
36
+ ```
37
+
38
+ # THIS PROJECT STILL IN DEVELOPMENT
@@ -1,4 +1,4 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,31 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="DDownloader",
5
+ version="0.1.5",
6
+ description="A downloader for DRM-protected content.",
7
+ long_description=open("README.md").read(),
8
+ long_description_content_type="text/markdown",
9
+ author="ThatNotEasy",
10
+ author_email="apidotmy@proton.me",
11
+ url="https://github.com/ThatNotEasy/DDownloader",
12
+ license="MIT",
13
+ packages=find_packages(),
14
+ classifiers=[
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ],
19
+ python_requires=">=3.10",
20
+ install_requires=[
21
+ "requests",
22
+ "coloredlogs",
23
+ "loguru",
24
+ "argparse",
25
+ ],
26
+ entry_points={
27
+ "console_scripts": [
28
+ "ddownloader=ddownloader.main:main",
29
+ ],
30
+ },
31
+ )
@@ -1,3 +0,0 @@
1
- from .hls_downloader import HLSDownloader
2
- from .dash_downloader import DASHDownloader
3
- from .decrypt_downloader import DecryptDownloader
@@ -1,44 +0,0 @@
1
- import requests
2
- import os
3
- import xml.etree.ElementTree as ET
4
- import subprocess
5
-
6
- class DASHDownloader:
7
- def __init__(self, manifest_url):
8
- self.manifest_url = manifest_url
9
- self.binary_path = os.path.join(os.path.dirname(__file__), 'bin', 'N_m3u8DL-RE')
10
-
11
- def download_with_n_m3u8dl(self):
12
- command = [self.binary_path, self.manifest_url]
13
- try:
14
- exit_code = subprocess.run(command, check=True)
15
- print("Downloaded using N_m3u8DL-RE")
16
- except subprocess.CalledProcessError as e:
17
- print(f"Error during download: {e}")
18
-
19
- def download_manifest(self):
20
- response = requests.get(self.manifest_url)
21
- response.raise_for_status()
22
- return response.content
23
-
24
- def download_segments(self, manifest_content, output_dir='downloads'):
25
- os.makedirs(output_dir, exist_ok=True)
26
- root = ET.fromstring(manifest_content)
27
-
28
- for adaptation_set in root.findall('.//AdaptationSet'):
29
- for representation in adaptation_set.findall('Representation'):
30
- base_url = representation.attrib.get('baseURL', '')
31
- for segment in representation.findall('.//SegmentURL'):
32
- segment_url = base_url + segment.attrib['media']
33
- self.download_segment(segment_url, output_dir)
34
-
35
- def download_segment(self, segment_url, output_dir):
36
- response = requests.get(segment_url, stream=True)
37
- response.raise_for_status()
38
-
39
- filename = os.path.join(output_dir, segment_url.split("/")[-1])
40
- with open(filename, 'wb') as f:
41
- for chunk in response.iter_content(chunk_size=8192):
42
- f.write(chunk)
43
-
44
- print(f"Downloaded: {filename}")
@@ -1,39 +0,0 @@
1
- import os
2
- import subprocess
3
-
4
- class DecryptDownloader:
5
- def __init__(self):
6
- self.kid = None
7
- self.key = None
8
- self.manifest_url = None
9
- self.binary_path = os.path.join(os.path.dirname(__file__), 'bin', 'mp4decrypt') # Adjust if necessary
10
-
11
- def set_manifest_url(self, manifest_url):
12
- self.manifest_url = manifest_url
13
-
14
- def set_decryption_key(self, key):
15
- self.key = key
16
-
17
- def set_kid(self, kid):
18
- self.kid = kid
19
-
20
- def download_and_decrypt(self, input_file, output_file):
21
- if not self.key:
22
- print("Decryption key is not set.")
23
- return
24
-
25
- self.download_media_file() # Placeholder for your download logic
26
-
27
- command = [self.binary_path, '--key', f'{self.kid}:{self.key}', input_file, output_file]
28
- try:
29
- exit_code = subprocess.run(command, check=True)
30
- print(f"Decrypted file saved as: {output_file}")
31
- except subprocess.CalledProcessError as e:
32
- print(f"Error during decryption: {e}")
33
-
34
- def download_media_file(self):
35
- if not self.manifest_url:
36
- print("Manifest URL is not set.")
37
- return
38
-
39
- print(f"Downloading media from: {self.manifest_url}")
@@ -1,40 +0,0 @@
1
- import requests
2
- import os
3
- import subprocess
4
-
5
- class HLSDownloader:
6
- def __init__(self, manifest_url):
7
- self.manifest_url = manifest_url
8
- self.binary_path = os.path.join(os.path.dirname(__file__), 'bin', 'N_m3u8DL-RE')
9
-
10
- def download_with_n_m3u8dl(self):
11
- command = [self.binary_path, self.manifest_url]
12
- try:
13
- exit_code = subprocess.run(command, check=True)
14
- print("Downloaded using N_m3u8DL-RE")
15
- except subprocess.CalledProcessError as e:
16
- print(f"Error during download: {e}")
17
-
18
- def download_manifest(self):
19
- response = requests.get(self.manifest_url)
20
- response.raise_for_status()
21
- return response.text
22
-
23
- def download_segments(self, manifest_content, output_dir='downloads'):
24
- os.makedirs(output_dir, exist_ok=True)
25
- lines = manifest_content.splitlines()
26
- for line in lines:
27
- if line.endswith('.ts'):
28
- segment_url = line
29
- self.download_segment(segment_url, output_dir)
30
-
31
- def download_segment(self, segment_url, output_dir):
32
- response = requests.get(segment_url, stream=True)
33
- response.raise_for_status()
34
-
35
- filename = os.path.join(output_dir, segment_url.split("/")[-1])
36
- with open(filename, 'wb') as f:
37
- for chunk in response.iter_content(chunk_size=8192):
38
- f.write(chunk)
39
-
40
- print(f"Downloaded: {filename}")
@@ -1,77 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: DDownloader
3
- Version: 0.1.3
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
-
14
- # DDownloader
15
-
16
- **DDownloader** is a Python library to download HLS and DASH manifests and decrypt media files.
17
-
18
- ## Features
19
- - Download HLS streams using `N_m3u8DL-RE`.
20
- - Download DASH manifests and segments.
21
- - Decrypt media files using `mp4decrypt`.
22
-
23
- ## Installation
24
-
25
- Use the package manager [pip](https://pypi.org/project/DDownloader/0.1.3/) to install DDownloader.
26
-
27
- ```bash
28
- pip install DDownloader==0.1.3
29
- ```
30
-
31
- ## Usage
32
- - Download HLS content using the library:
33
- ```python
34
- from DDownloader import HLSDownloader
35
-
36
- hls_downloader = HLSDownloader("https://example.com/playlist.m3u8")
37
- hls_downloader.download_with_n_m3u8dl()
38
- ```
39
- - Download Dash content using the library:
40
- ```python
41
- from DDownloader import DASHDownloader
42
-
43
- dash_downloader = DASHDownloader("https://example.com/manifest.mpd")
44
- dash_downloader.download_with_n_m3u8dl()
45
- ```
46
- - To decrypt media files after downloading:
47
- ```python
48
- from DDownloader import DecryptDownloader
49
-
50
- decrypt_downloader = DecryptDownloader()
51
- decrypt_downloader.set_manifest_url("https://example.com/manifest.mpd")
52
- decrypt_downloader.set_decryption_key("0123456789abcdef0123456789abcdef")
53
- decrypt_downloader.set_kid("1:0123456789abcdef0123456789abcdef")
54
- decrypt_downloader.download_and_decrypt("encrypted_file.mp4", "decrypted_file.mp4")
55
- ```
56
- - Here's a complete example demonstrating the use of all features:
57
- ```python
58
- from DDownloader import HLSDownloader, DASHDownloader, DecryptDownloader
59
-
60
- # HLS Download Example
61
- hls_url = "https://example.com/playlist.m3u8"
62
- hls_downloader = HLSDownloader(hls_url)
63
- hls_downloader.download_with_n_m3u8dl()
64
-
65
- # DASH Download Example
66
- dash_url = "https://example.com/manifest.mpd"
67
- dash_downloader = DASHDownloader(dash_url)
68
- dash_downloader.download_with_n_m3u8dl()
69
-
70
- # Decrypting Example
71
- decrypt_downloader = DecryptDownloader()
72
- decrypt_downloader.set_manifest_url(dash_url)
73
- decrypt_downloader.set_decryption_key("0123456789abcdef0123456789abcdef")
74
- decrypt_downloader.set_kid("1:0123456789abcdef0123456789abcdef")
75
- decrypt_downloader.download_and_decrypt("encrypted_file.mp4", "decrypted_file.mp4")
76
-
77
- ```
@@ -1 +0,0 @@
1
- requests
@@ -1,77 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: DDownloader
3
- Version: 0.1.3
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
-
14
- # DDownloader
15
-
16
- **DDownloader** is a Python library to download HLS and DASH manifests and decrypt media files.
17
-
18
- ## Features
19
- - Download HLS streams using `N_m3u8DL-RE`.
20
- - Download DASH manifests and segments.
21
- - Decrypt media files using `mp4decrypt`.
22
-
23
- ## Installation
24
-
25
- Use the package manager [pip](https://pypi.org/project/DDownloader/0.1.3/) to install DDownloader.
26
-
27
- ```bash
28
- pip install DDownloader==0.1.3
29
- ```
30
-
31
- ## Usage
32
- - Download HLS content using the library:
33
- ```python
34
- from DDownloader import HLSDownloader
35
-
36
- hls_downloader = HLSDownloader("https://example.com/playlist.m3u8")
37
- hls_downloader.download_with_n_m3u8dl()
38
- ```
39
- - Download Dash content using the library:
40
- ```python
41
- from DDownloader import DASHDownloader
42
-
43
- dash_downloader = DASHDownloader("https://example.com/manifest.mpd")
44
- dash_downloader.download_with_n_m3u8dl()
45
- ```
46
- - To decrypt media files after downloading:
47
- ```python
48
- from DDownloader import DecryptDownloader
49
-
50
- decrypt_downloader = DecryptDownloader()
51
- decrypt_downloader.set_manifest_url("https://example.com/manifest.mpd")
52
- decrypt_downloader.set_decryption_key("0123456789abcdef0123456789abcdef")
53
- decrypt_downloader.set_kid("1:0123456789abcdef0123456789abcdef")
54
- decrypt_downloader.download_and_decrypt("encrypted_file.mp4", "decrypted_file.mp4")
55
- ```
56
- - Here's a complete example demonstrating the use of all features:
57
- ```python
58
- from DDownloader import HLSDownloader, DASHDownloader, DecryptDownloader
59
-
60
- # HLS Download Example
61
- hls_url = "https://example.com/playlist.m3u8"
62
- hls_downloader = HLSDownloader(hls_url)
63
- hls_downloader.download_with_n_m3u8dl()
64
-
65
- # DASH Download Example
66
- dash_url = "https://example.com/manifest.mpd"
67
- dash_downloader = DASHDownloader(dash_url)
68
- dash_downloader.download_with_n_m3u8dl()
69
-
70
- # Decrypting Example
71
- decrypt_downloader = DecryptDownloader()
72
- decrypt_downloader.set_manifest_url(dash_url)
73
- decrypt_downloader.set_decryption_key("0123456789abcdef0123456789abcdef")
74
- decrypt_downloader.set_kid("1:0123456789abcdef0123456789abcdef")
75
- decrypt_downloader.download_and_decrypt("encrypted_file.mp4", "decrypted_file.mp4")
76
-
77
- ```
@@ -1,64 +0,0 @@
1
- # DDownloader
2
-
3
- **DDownloader** is a Python library to download HLS and DASH manifests and decrypt media files.
4
-
5
- ## Features
6
- - Download HLS streams using `N_m3u8DL-RE`.
7
- - Download DASH manifests and segments.
8
- - Decrypt media files using `mp4decrypt`.
9
-
10
- ## Installation
11
-
12
- Use the package manager [pip](https://pypi.org/project/DDownloader/0.1.3/) to install DDownloader.
13
-
14
- ```bash
15
- pip install DDownloader==0.1.3
16
- ```
17
-
18
- ## Usage
19
- - Download HLS content using the library:
20
- ```python
21
- from DDownloader import HLSDownloader
22
-
23
- hls_downloader = HLSDownloader("https://example.com/playlist.m3u8")
24
- hls_downloader.download_with_n_m3u8dl()
25
- ```
26
- - Download Dash content using the library:
27
- ```python
28
- from DDownloader import DASHDownloader
29
-
30
- dash_downloader = DASHDownloader("https://example.com/manifest.mpd")
31
- dash_downloader.download_with_n_m3u8dl()
32
- ```
33
- - To decrypt media files after downloading:
34
- ```python
35
- from DDownloader import DecryptDownloader
36
-
37
- decrypt_downloader = DecryptDownloader()
38
- decrypt_downloader.set_manifest_url("https://example.com/manifest.mpd")
39
- decrypt_downloader.set_decryption_key("0123456789abcdef0123456789abcdef")
40
- decrypt_downloader.set_kid("1:0123456789abcdef0123456789abcdef")
41
- decrypt_downloader.download_and_decrypt("encrypted_file.mp4", "decrypted_file.mp4")
42
- ```
43
- - Here's a complete example demonstrating the use of all features:
44
- ```python
45
- from DDownloader import HLSDownloader, DASHDownloader, DecryptDownloader
46
-
47
- # HLS Download Example
48
- hls_url = "https://example.com/playlist.m3u8"
49
- hls_downloader = HLSDownloader(hls_url)
50
- hls_downloader.download_with_n_m3u8dl()
51
-
52
- # DASH Download Example
53
- dash_url = "https://example.com/manifest.mpd"
54
- dash_downloader = DASHDownloader(dash_url)
55
- dash_downloader.download_with_n_m3u8dl()
56
-
57
- # Decrypting Example
58
- decrypt_downloader = DecryptDownloader()
59
- decrypt_downloader.set_manifest_url(dash_url)
60
- decrypt_downloader.set_decryption_key("0123456789abcdef0123456789abcdef")
61
- decrypt_downloader.set_kid("1:0123456789abcdef0123456789abcdef")
62
- decrypt_downloader.download_and_decrypt("encrypted_file.mp4", "decrypted_file.mp4")
63
-
64
- ```
@@ -1,24 +0,0 @@
1
- from setuptools import setup, find_packages
2
-
3
- setup(
4
- name='DDownloader',
5
- version='0.1.3',
6
- description='A library to download HLS and DASH manifests and decrypt media files.',
7
- long_description=open('README.md').read(),
8
- long_description_content_type='text/markdown',
9
- author='Pari Malam',
10
- author_email='shafiqsamsuri@serasi.tech',
11
- packages=find_packages(),
12
- install_requires=[
13
- 'requests',
14
- ],
15
- classifiers=[
16
- 'Programming Language :: Python :: 3',
17
- 'License :: OSI Approved :: MIT License',
18
- 'Operating System :: OS Independent',
19
- ],
20
- python_requires='>=3.9',
21
- package_data={
22
- '': ['bin/*'],
23
- },
24
- )