From bcafbe77c007d7b6d9491b73adebc1c4bc512b73 Mon Sep 17 00:00:00 2001 From: Matthew Foran Date: Mon, 23 May 2022 19:11:49 -0400 Subject: [PATCH] fixed typo, linux compatbility --- singlefile.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/singlefile.py b/singlefile.py index de1a3cd..27a86c5 100644 --- a/singlefile.py +++ b/singlefile.py @@ -1,7 +1,7 @@ from subprocess import run -SINGLEFILE_BINARY_PATH = ".\\node_modules\\single-file\\cli\\single-file" -#CHROME_PATH = "C:\\Program Files\\Google\Chrome\\Application\\chrome.exe" #Uncomment this and set your browser exe if it can't find yours. +SINGLEFILE_BINARY_PATH = "./node_modules/single-file/cli/single-file" +CHROME_PATH = "C:/Program Files/Google\ Chrome/Application/chrome.exe" #Uncomment this and set your browser exe if it can't find yours. def addQuotes(str): return "\"" + str.strip("\"") + "\"" @@ -9,7 +9,7 @@ def addQuotes(str): def download_page(url, cookies_path, output_path, output_name_template = ""): args = [ addQuotes(SINGLEFILE_BINARY_PATH), - #"--browser-executeable-path=" + addQuotes(CHROME_PATH.strip("\"")), #Uncomment this and set your browser exe if it can't find yours. + #"--browser-executable-path=" + addQuotes(CHROME_PATH.strip("\"")), #Uncomment this and set your browser exe if it can't find yours. "--browser-cookies-file=" + addQuotes(cookies_path), "--output-directory=" + addQuotes(output_path), url @@ -19,10 +19,9 @@ def download_page(url, cookies_path, output_path, output_name_template = ""): args.append("--filename-template=" + addQuotes(output_name_template)) try: - run("node " + " ".join(args)) + run("node " + " ".join(args), shell=True) except Exception as e: - print("Was not able to save the URL " + url + " using singlefile. The reported error was " + - e.strerror) + print("Was not able to save the URL " + url + " using singlefile. The reported error was " + e.strerror) #if __name__ == "__main__": - #download_page("https://www.google.com/", "", ".\\output\\test", "test.html") \ No newline at end of file + #download_page("https://www.google.com/", "", "./output/test", "test.html")