gildas-lormeau / single-file-cli

CLI tool for saving a faithful copy of a complete web page in a single HTML file (based on SingleFile)
GNU Affero General Public License v3.0
540 stars 58 forks source link

Not working with sites having css or javascript. #7

Closed amalgame21 closed 1 year ago

amalgame21 commented 1 year ago

Like the webpabe https://github.com/gildas-lormeau/single-file-cli Downloaded the page somewhat just like wget does.

To reproduce: System: Arch Linux

install single-file-cli by command:

unzip master.zip .
cd single-file-cli-master
npm install

cd to the directory, make executable by chmod +x single-file symlink single-file to ~/.local/bin which is in the PATH

Installed geckodriver by sudo pacman -S geckodriver

Run the below command in terminal, all can download, but the outcome just like wget single-file https://github.com/gildas-lormeau/single-file-cli --back-end=webdriver-gecko single-file https://github.com/gildas-lormeau/single-file-cli --back-end=webdriver-chromium

And I have no idea how puppeteer work without the --back-end flag. just prompt error Failed to launch the browser process! spawn chrome ENOENT everytime.

gildas-lormeau commented 1 year ago

This error message means that puppeteer was not able to find the chrome executable. To fix this, you have to use the option --browser-executable-path and pass the full path to chrome.

amalgame21 commented 1 year ago

This error message means that puppeteer was not able to find the chrome executable. To fix this, you have to use the option --browser-executable-path and pass the full path to chrome.

Thanks for your help! Now this command is working perfectly fine: single-file https://github.com/gildas-lormeau/single-file-cli --back-end=puppeteer --browser-executable-path $(which chromium)

However puppeteer-firefox like this does not work single-file https://github.com/gildas-lormeau/single-file-cli --back-end=puppeteer-firefox --browser-executable-path $(which firefox)

with error message:

Navigation timeout of 60000 ms exceeded URL: https://github.com/gildas-lormeau/single-file-cli
Stack: TimeoutError: Navigation timeout of 60000 ms exceeded
    at /home/hello/single-file-cli-master/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.js:113:111

--back-end=webdriver-gecko and --back-end=webdriver-chromium can download webpage, but result still like wget.

I think this solve my problem, I may stick with puppeteer and chromium. Thanks!