This commit is contained in:
2026-03-06 00:57:50 -08:00
parent a29d7508ec
commit d7e42b9563
4 changed files with 1121 additions and 8 deletions

View File

@@ -22,7 +22,7 @@
"((1fichier\\.com|megadl\\.fr|alterupload\\.com|cjoint\\.net|desfichiers\\.com|dfichiers\\.com|mesfichiers\\.org|piecejointe\\.net|pjointe\\.com|tenvoi\\.com|dl4free\\.com)/\\?[a-zA-Z0-9]{5,30}(&pw=[^&]+)?)" "((1fichier\\.com|megadl\\.fr|alterupload\\.com|cjoint\\.net|desfichiers\\.com|dfichiers\\.com|mesfichiers\\.org|piecejointe\\.net|pjointe\\.com|tenvoi\\.com|dl4free\\.com)/\\?[a-zA-Z0-9]{5,30}(&pw=[^&]+)?)"
], ],
"regexp": "((1fichier\\.com|megadl\\.fr|alterupload\\.com|cjoint\\.net|desfichiers\\.com|dfichiers\\.com|mesfichiers\\.org|piecejointe\\.net|pjointe\\.com|tenvoi\\.com|dl4free\\.com)/\\?[a-zA-Z0-9]{5,30}(&pw=[^&]+)?)", "regexp": "((1fichier\\.com|megadl\\.fr|alterupload\\.com|cjoint\\.net|desfichiers\\.com|dfichiers\\.com|mesfichiers\\.org|piecejointe\\.net|pjointe\\.com|tenvoi\\.com|dl4free\\.com)/\\?[a-zA-Z0-9]{5,30}(&pw=[^&]+)?)",
"status": false "status": true
}, },
"rapidgator": { "rapidgator": {
"name": "rapidgator", "name": "rapidgator",
@@ -398,7 +398,7 @@
"(gigapeta\\.com/dl/[0-9a-zA-Z]{13,15})" "(gigapeta\\.com/dl/[0-9a-zA-Z]{13,15})"
], ],
"regexp": "(gigapeta\\.com/dl/[0-9a-zA-Z]{13,15})", "regexp": "(gigapeta\\.com/dl/[0-9a-zA-Z]{13,15})",
"status": false "status": true
}, },
"google": { "google": {
"name": "google", "name": "google",
@@ -425,7 +425,7 @@
"(hexupload\\.net|hexload\\.com)/([a-zA-Z0-9]{12})" "(hexupload\\.net|hexload\\.com)/([a-zA-Z0-9]{12})"
], ],
"regexp": "(hexupload\\.net|hexload\\.com)/([a-zA-Z0-9]{12})", "regexp": "(hexupload\\.net|hexload\\.com)/([a-zA-Z0-9]{12})",
"status": false "status": true
}, },
"hot4share": { "hot4share": {
"name": "hot4share", "name": "hot4share",
@@ -494,7 +494,7 @@
"mediafire\\.com/(\\?|download/|file/|download\\.php\\?)([0-9a-z]{15})" "mediafire\\.com/(\\?|download/|file/|download\\.php\\?)([0-9a-z]{15})"
], ],
"regexp": "mediafire\\.com/(\\?|download/|file/|download\\.php\\?)([0-9a-z]{15})", "regexp": "mediafire\\.com/(\\?|download/|file/|download\\.php\\?)([0-9a-z]{15})",
"status": false "status": true
}, },
"mixdrop": { "mixdrop": {
"name": "mixdrop", "name": "mixdrop",
@@ -595,7 +595,7 @@
"(simfileshare\\.net/download/[0-9]+/)" "(simfileshare\\.net/download/[0-9]+/)"
], ],
"regexp": "(simfileshare\\.net/download/[0-9]+/)", "regexp": "(simfileshare\\.net/download/[0-9]+/)",
"status": false "status": true
}, },
"streamtape": { "streamtape": {
"name": "streamtape", "name": "streamtape",

View File

@@ -83,11 +83,13 @@ def _detect_kind(ext: str) -> str:
return "unknown" return "unknown"
def _allowed(source_kind: str, target_kind: str) -> bool: def _allowed(source_kind: str, target_kind: str, target_ext: str = "") -> bool:
if source_kind == target_kind: if source_kind == target_kind:
return True return True
if source_kind == "video" and target_kind == "audio": if source_kind == "video" and target_kind == "audio":
return True return True
if source_kind == "video" and target_kind == "image" and target_ext.lower().lstrip(".") == "gif":
return True
return False return False
@@ -173,7 +175,7 @@ CMDLET = Cmdlet(
SharedArgs.DELETE, SharedArgs.DELETE,
], ],
detail=[ detail=[
"Allows video↔video, audio↔audio, image↔image, doc↔doc, and video→audio conversions.", "Allows video↔video, audio↔audio, image↔image, doc↔doc, video→audio, and video→gif conversions.",
"Disallows incompatible conversions (e.g., video→pdf).", "Disallows incompatible conversions (e.g., video→pdf).",
"Uses ffmpeg for media and pypandoc-binary (bundled pandoc) for document formats (mobi/epub→pdf/txt/etc); PDF output uses the tectonic LaTeX engine when available.", "Uses ffmpeg for media and pypandoc-binary (bundled pandoc) for document formats (mobi/epub→pdf/txt/etc); PDF output uses the tectonic LaTeX engine when available.",
], ],
@@ -250,7 +252,7 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
source_ext = input_path.suffix.lower().lstrip(".") source_ext = input_path.suffix.lower().lstrip(".")
source_kind = _detect_kind(source_ext) source_kind = _detect_kind(source_ext)
if not _allowed(source_kind, target_kind): if not _allowed(source_kind, target_kind, target_fmt):
log( log(
f"Conversion from {source_kind or 'unknown'} to {target_kind} is not allowed", f"Conversion from {source_kind or 'unknown'} to {target_kind} is not allowed",
file=sys.stderr, file=sys.stderr,

View File

@@ -109,6 +109,14 @@ class Download_File(Cmdlet):
debug(f"[download-file] run invoked with args: {list(args)}") debug(f"[download-file] run invoked with args: {list(args)}")
return self._run_impl(result, args, config) return self._run_impl(result, args, config)
@staticmethod
def _path_from_download_result(result_obj: Any) -> Path:
"""Normalize downloader return values to a concrete filesystem path."""
resolved = coerce_to_path(result_obj)
if resolved is None:
raise DownloadError("Could not determine downloaded file path")
return resolved
def _process_explicit_urls( def _process_explicit_urls(
self, self,
*, *,

File diff suppressed because it is too large Load Diff