megaloader-cli 0.1.0__tar.gz → 0.2.0__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.
- megaloader_cli-0.2.0/.gitignore +23 -0
- {megaloader_cli-0.1.0 → megaloader_cli-0.2.0}/PKG-INFO +4 -4
- megaloader_cli-0.2.0/megaloader_cli/__init__.py +1 -0
- {megaloader_cli-0.1.0 → megaloader_cli-0.2.0}/megaloader_cli/commands.py +5 -5
- {megaloader_cli-0.1.0 → megaloader_cli-0.2.0}/megaloader_cli/main.py +21 -5
- {megaloader_cli-0.1.0 → megaloader_cli-0.2.0}/pyproject.toml +5 -6
- megaloader_cli-0.1.0/.gitignore +0 -15
- megaloader_cli-0.1.0/megaloader_cli/__init__.py +0 -1
- {megaloader_cli-0.1.0 → megaloader_cli-0.2.0}/MANIFEST.in +0 -0
- {megaloader_cli-0.1.0 → megaloader_cli-0.2.0}/megaloader_cli/io.py +0 -0
- {megaloader_cli-0.1.0 → megaloader_cli-0.2.0}/megaloader_cli/utils.py +0 -0
- {megaloader_cli-0.1.0 → megaloader_cli-0.2.0}/readme.md +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# python artifacts
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.egg-info/
|
|
4
|
+
|
|
5
|
+
# environment variables
|
|
6
|
+
.env
|
|
7
|
+
|
|
8
|
+
# coverage outputs
|
|
9
|
+
.coverage
|
|
10
|
+
coverage.xml
|
|
11
|
+
junit.xml
|
|
12
|
+
|
|
13
|
+
# build artifacts
|
|
14
|
+
build/
|
|
15
|
+
dist/
|
|
16
|
+
*.spec
|
|
17
|
+
|
|
18
|
+
# tool-generated files
|
|
19
|
+
.vercel/
|
|
20
|
+
downloads/
|
|
21
|
+
|
|
22
|
+
*.ps1
|
|
23
|
+
*.sh
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: megaloader-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Command-line interface for Megaloader
|
|
5
|
-
|
|
5
|
+
Author-email: David Duran <dadch1404@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
7
7
|
Requires-Python: >=3.10
|
|
8
8
|
Requires-Dist: click>=8.1.0
|
|
9
|
-
Requires-Dist: megaloader
|
|
10
|
-
Requires-Dist: requests>=2.
|
|
9
|
+
Requires-Dist: megaloader>=0.2.0
|
|
10
|
+
Requires-Dist: requests>=2.34.2
|
|
11
11
|
Requires-Dist: rich>=13.7.0
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.0"
|
|
@@ -8,7 +8,7 @@ from typing import Any
|
|
|
8
8
|
import megaloader as mgl
|
|
9
9
|
|
|
10
10
|
from megaloader.exceptions import MegaloaderError
|
|
11
|
-
from megaloader.plugins import
|
|
11
|
+
from megaloader.plugins import get_plugin_for_domain
|
|
12
12
|
from rich.progress import (
|
|
13
13
|
BarColumn,
|
|
14
14
|
DownloadColumn,
|
|
@@ -22,7 +22,7 @@ from megaloader_cli.io import download_file
|
|
|
22
22
|
from megaloader_cli.utils import console, sanitize_for_filesystem
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
def extract_command(url: str, output_json: bool) -> None:
|
|
25
|
+
def extract_command(url: str, output_json: bool, options: dict[str, Any]) -> None:
|
|
26
26
|
"""
|
|
27
27
|
Handle extract command logic.
|
|
28
28
|
|
|
@@ -37,7 +37,7 @@ def extract_command(url: str, output_json: bool) -> None:
|
|
|
37
37
|
items = []
|
|
38
38
|
if output_json:
|
|
39
39
|
# Silent extraction for JSON mode
|
|
40
|
-
for item in mgl.extract(url):
|
|
40
|
+
for item in mgl.extract(url, **options):
|
|
41
41
|
items.append(item)
|
|
42
42
|
else:
|
|
43
43
|
# Show progress for human-readable mode
|
|
@@ -48,7 +48,7 @@ def extract_command(url: str, output_json: bool) -> None:
|
|
|
48
48
|
) as progress:
|
|
49
49
|
task = progress.add_task("", total=None)
|
|
50
50
|
|
|
51
|
-
for item in mgl.extract(url):
|
|
51
|
+
for item in mgl.extract(url, **options):
|
|
52
52
|
items.append(item)
|
|
53
53
|
progress.update(task, advance=1)
|
|
54
54
|
|
|
@@ -193,7 +193,7 @@ def _get_plugin_name(url: str) -> str | None:
|
|
|
193
193
|
from urllib.parse import urlparse
|
|
194
194
|
|
|
195
195
|
domain = urlparse(url).netloc
|
|
196
|
-
plugin_class =
|
|
196
|
+
plugin_class = get_plugin_for_domain(domain)
|
|
197
197
|
return plugin_class.__name__ if plugin_class else None
|
|
198
198
|
|
|
199
199
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
1
3
|
import click
|
|
2
4
|
|
|
3
5
|
from megaloader.plugins import PLUGIN_REGISTRY
|
|
@@ -28,14 +30,23 @@ def cli() -> None:
|
|
|
28
30
|
help="Output JSON instead of human-readable text",
|
|
29
31
|
)
|
|
30
32
|
@click.option("-v", "--verbose", is_flag=True, help="Enable debug logging")
|
|
31
|
-
|
|
33
|
+
@click.option("--password", help="Password for protected content (Gofile)")
|
|
34
|
+
@click.option("--token", help="API token for authenticated access (Gofile)")
|
|
35
|
+
def extract_cmd(
|
|
36
|
+
url: str, output_json: bool, verbose: bool, password: str | None, token: str | None
|
|
37
|
+
) -> None:
|
|
32
38
|
"""
|
|
33
39
|
Extract metadata from URL without downloading (dry run).
|
|
34
40
|
|
|
35
41
|
Shows what would be downloaded including filenames, sizes, and URLs.
|
|
36
42
|
"""
|
|
37
43
|
setup_logging(verbose)
|
|
38
|
-
|
|
44
|
+
options: dict[str, Any] = {}
|
|
45
|
+
if password:
|
|
46
|
+
options["password"] = password
|
|
47
|
+
if token:
|
|
48
|
+
options["token"] = token
|
|
49
|
+
extract_command(url, output_json, options)
|
|
39
50
|
|
|
40
51
|
|
|
41
52
|
@cli.command(name="download")
|
|
@@ -56,6 +67,10 @@ def extract_cmd(url: str, output_json: bool, verbose: bool) -> None:
|
|
|
56
67
|
"--password",
|
|
57
68
|
help="Password for protected content (Gofile)",
|
|
58
69
|
)
|
|
70
|
+
@click.option(
|
|
71
|
+
"--token",
|
|
72
|
+
help="API token for authenticated access (Gofile)",
|
|
73
|
+
)
|
|
59
74
|
def download_cmd(
|
|
60
75
|
url: str,
|
|
61
76
|
output_dir: str,
|
|
@@ -63,6 +78,7 @@ def download_cmd(
|
|
|
63
78
|
flat: bool,
|
|
64
79
|
pattern: str | None,
|
|
65
80
|
password: str | None,
|
|
81
|
+
token: str | None,
|
|
66
82
|
) -> None:
|
|
67
83
|
"""
|
|
68
84
|
Download content from URL to OUTPUT_DIR.
|
|
@@ -71,11 +87,11 @@ def download_cmd(
|
|
|
71
87
|
Use --flat to disable this behavior.
|
|
72
88
|
"""
|
|
73
89
|
setup_logging(verbose)
|
|
74
|
-
|
|
75
|
-
options = {}
|
|
90
|
+
options: dict[str, Any] = {}
|
|
76
91
|
if password:
|
|
77
92
|
options["password"] = password
|
|
78
|
-
|
|
93
|
+
if token:
|
|
94
|
+
options["token"] = token
|
|
79
95
|
download_command(url, output_dir, flat, pattern, options)
|
|
80
96
|
|
|
81
97
|
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "megaloader-cli"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.2.0"
|
|
4
4
|
description = "Command-line interface for Megaloader"
|
|
5
|
-
|
|
6
|
-
license = "Apache-2.0"
|
|
7
5
|
readme = "readme.md"
|
|
8
6
|
requires-python = ">=3.10"
|
|
7
|
+
license = "Apache-2.0"
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
authors = [
|
|
11
10
|
{ name = "David Duran", email = "dadch1404@gmail.com" },
|
|
12
11
|
]
|
|
13
12
|
|
|
14
13
|
dependencies = [
|
|
15
|
-
"megaloader",
|
|
14
|
+
"megaloader>=0.2.0",
|
|
16
15
|
"click>=8.1.0",
|
|
17
16
|
"rich>=13.7.0",
|
|
18
|
-
"requests>=2.
|
|
17
|
+
"requests>=2.34.2",
|
|
19
18
|
]
|
|
20
19
|
|
|
21
20
|
[tool.uv.sources]
|
megaloader_cli-0.1.0/.gitignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|