add --no-exec option to harden security
This commit is contained in:
parent
b82b2ace4c
commit
977f8839a5
1 changed files with 4 additions and 2 deletions
|
|
@ -243,7 +243,7 @@ impl fmt::Display for YtDlpError {
|
||||||
pub struct YtDlp {}
|
pub struct YtDlp {}
|
||||||
impl YtDlp {
|
impl YtDlp {
|
||||||
pub async fn load_info(url: &str) -> Result<YtDlpInfo, YtDlpError> {
|
pub async fn load_info(url: &str) -> Result<YtDlpInfo, YtDlpError> {
|
||||||
let output = spawn("python", &["-m", "yt_dlp", url, "-j"]).await?;
|
let output = spawn("python", &["-m", "yt_dlp", url, "-j", "--no-exec"]).await?;
|
||||||
|
|
||||||
let info = YtDlpInfo::parse(&output.stdout)?;
|
let info = YtDlpInfo::parse(&output.stdout)?;
|
||||||
if info.formats.is_empty() {
|
if info.formats.is_empty() {
|
||||||
|
|
@ -254,7 +254,7 @@ impl YtDlp {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn download(url: &str, info: &YtDlpInfo) -> Result<TmpFile, YtDlpError> {
|
pub async fn download(url: &str, info: &YtDlpInfo) -> Result<TmpFile, YtDlpError> {
|
||||||
let file = TmpFile::new(&info.id)?;
|
let file = TmpFile::new(&format!("{}.bin", info.id))?;
|
||||||
|
|
||||||
spawn(
|
spawn(
|
||||||
"python",
|
"python",
|
||||||
|
|
@ -265,6 +265,7 @@ impl YtDlp {
|
||||||
"-o",
|
"-o",
|
||||||
&file.path,
|
&file.path,
|
||||||
"--force-overwrites",
|
"--force-overwrites",
|
||||||
|
"--no-exec",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
@ -294,6 +295,7 @@ impl YtDlp {
|
||||||
"-o",
|
"-o",
|
||||||
&file.path,
|
&file.path,
|
||||||
"--force-overwrites",
|
"--force-overwrites",
|
||||||
|
"--no-exec",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue