DDownloader 0.1.3__tar.gz → 0.1.4__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,49 @@
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}")
@@ -0,0 +1,49 @@
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}")
@@ -0,0 +1,80 @@
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
@@ -2,10 +2,13 @@ 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
7
6
  DDownloader.egg-info/PKG-INFO
8
7
  DDownloader.egg-info/SOURCES.txt
9
8
  DDownloader.egg-info/dependency_links.txt
10
9
  DDownloader.egg-info/requires.txt
11
- DDownloader.egg-info/top_level.txt
10
+ DDownloader.egg-info/top_level.txt
11
+ DDownloader/bin/N_m3u8DL-RE
12
+ DDownloader/bin/N_m3u8DL-RE.exe
13
+ DDownloader/bin/packager-linux-x64
14
+ DDownloader/bin/packager-win-x64.exe
@@ -0,0 +1,2 @@
1
+ requests
2
+ coloredlogs
@@ -0,0 +1,80 @@
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
@@ -0,0 +1,66 @@
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.4/) to install DDownloader.
13
+
14
+ ```bash
15
+ pip install DDownloader==0.1.4
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ - Download DASH content using the library:
21
+ ```python
22
+ from DDownloader.dash_downloader import DASH
23
+
24
+ dash_downloader = DASH()
25
+ dash_downloader.manifest_url = "https://example.com/path/to/manifest.mpd" # Set your DASH manifest URL
26
+ dash_downloader.output_name = "output.mp4" # Set desired output name
27
+ dash_downloader.decryption_key = "12345:678910" # Set decryption key if needed
28
+ dash_downloader.dash_downloader() # Call the downloader method
29
+ ```
30
+
31
+ - Download HLS content using the library:
32
+ ```python
33
+ from DDownloader.hls_downloader import HLS
34
+
35
+ hls_downloader = HLS()
36
+ hls_downloader.manifest_url = "https://example.com/path/to/manifest.m3u8" # Set your HLS manifest URL
37
+ hls_downloader.output_name = "output.mp4" # Set desired output name
38
+ hls_downloader.decryption_key = "12345:678910" # Set decryption key if needed
39
+ hls_downloader.hls_downloader() # Call the downloader method
40
+ ```
41
+
42
+ - Here's a complete example demonstrating the use of all features:
43
+ ```python
44
+ from DDownloader.dash_downloader import DASH
45
+ from DDownloader.hls_downloader import HLS
46
+
47
+ def download_dash():
48
+ dash_downloader = DASH()
49
+ dash_downloader.manifest_url = "https://example.com/path/to/manifest.mpd" # Set your DASH manifest URL
50
+ dash_downloader.output_name = "output.mp4" # Set desired output name
51
+ dash_downloader.decryption_key = "12345:678910" # Set decryption key if needed
52
+ dash_downloader.dash_downloader() # Call the downloader method
53
+
54
+ def download_hls():
55
+ hls_downloader = HLS()
56
+ hls_downloader.manifest_url = "https://example.com/path/to/manifest.m3u8" # Set your HLS manifest URL
57
+ hls_downloader.output_name = "output_hls" # Set desired output name
58
+ hls_downloader.decryption_key = "your_decryption_key" # Set decryption key if needed
59
+ hls_downloader.hls_downloader() # Call the downloader method
60
+
61
+ if __name__ == "__main__":
62
+ download_dash() # Download DASH content
63
+ download_hls() # Download HLS content
64
+ ```
65
+
66
+ ## THIS PROJECT STILL IN DEVELOPMENT
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='DDownloader',
5
- version='0.1.3',
5
+ version='0.1.4',
6
6
  description='A library to download HLS and DASH manifests and decrypt media files.',
7
7
  long_description=open('README.md').read(),
8
8
  long_description_content_type='text/markdown',
@@ -11,6 +11,7 @@ setup(
11
11
  packages=find_packages(),
12
12
  install_requires=[
13
13
  'requests',
14
+ 'coloredlogs'
14
15
  ],
15
16
  classifiers=[
16
17
  'Programming Language :: Python :: 3',
@@ -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
- ```
File without changes