xuzhengyi1995 / Manga_downloader

A Manga download framework using selenium.
607 stars 57 forks source link

Can't download using Docker #163

Closed adut24 closed 3 months ago

adut24 commented 3 months ago

Since I'm on macOS, I wanted to use the program with Docker but when I did docker compose up, I get this error:

[+] Building 34.1s (17/17) FINISHED                                                                                                    docker:desktop-linux
 => [python internal] load build definition from Dockerfile                                                                                            0.0s
 => => transferring dockerfile: 1.15kB                                                                                                                 0.0s
 => [python internal] load metadata for docker.io/library/python:3.8                                                                                   5.6s
 => [python internal] load .dockerignore                                                                                                               0.0s
 => => transferring context: 2B                                                                                                                        0.0s
 => [python internal] load build context                                                                                                               0.0s
 => => transferring context: 14.54kB                                                                                                                   0.0s
 => [python  1/12] FROM docker.io/library/python:3.8@sha256:77e340f69aafc51cd88769eb690e4ac8bcbd20a29dc540d403a5c4d3fd78198f                           0.0s
 => CACHED [python  2/12] RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -                                       0.0s
 => CACHED [python  3/12] RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chr  0.0s
 => CACHED [python  4/12] RUN apt-get -y update                                                                                                        0.0s
 => CACHED [python  5/12] RUN apt-get install -y google-chrome-stable                                                                                  0.0s
 => CACHED [python  6/12] RUN apt-get install -yqq unzip                                                                                               0.0s
 => CACHED [python  7/12] RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/     && curl -sS chromedriver.storage.googleap  0.0s
 => CACHED [python  8/12] WORKDIR /usr/src/app                                                                                                         0.0s
 => [python  9/12] COPY . /app                                                                                                                         0.1s
 => [python 10/12] WORKDIR /app                                                                                                                        0.1s
 => [python 11/12] RUN pip install --upgrade pip                                                                                                       9.1s
 => [python 12/12] RUN pip install -r requirements.txt                                                                                                18.1s 
 => [python] exporting to image                                                                                                                        0.9s 
 => => exporting layers                                                                                                                                0.8s 
 => => writing image sha256:6302244619511aeaddb43b90494d20df15f64c58f3fc74b93f76b8f44f38c51f                                                           0.0s 
 => => naming to docker.io/library/manga_downloader-python                                                                                             0.0s 
[+] Running 2/2                                                                                                                                             
 ✔ Network manga_downloader_default  Created                                                                                                           0.2s 
 ✔ Container mangadw                 Created                                                                                                           0.2s 
Attaching to mangadw
mangadw  | [INFO](undetected_chromedriver.patcher) 2024-03-27 12:51:12 : patching driver executable /root/.local/share/undetected_chromedriver/undetected_chromedriver
mangadw  | [INFO](root) 2024-03-27 12:51:16 : Viewport dimensions [784, 1200]
mangadw  | [INFO](root) 2024-03-27 12:51:16 : Find action class, use CmoaJP class.
mangadw  | [INFO](root) 2024-03-27 12:51:16 : Login...
mangadw  | Traceback (most recent call last):
mangadw  |   File "main.py", line 43, in <module>
mangadw  |     downloader.download()
mangadw  |   File "/app/downloader.py", line 214, in download
mangadw  |     self.login()
mangadw  |   File "/app/downloader.py", line 131, in login
mangadw  |     driver.get(self.actions_class.login_url)
mangadw  |   File "/usr/local/lib/python3.8/site-packages/undetected_chromedriver/__init__.py", line 629, in get_wrapped
mangadw  |     return orig_get(*args, **kwargs)
mangadw  |   File "/usr/local/lib/python3.8/site-packages/undetected_chromedriver/__init__.py", line 665, in get
mangadw  |     return super().get(url)
mangadw  |   File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 356, in get
mangadw  |     self.execute(Command.GET, {"url": url})
mangadw  |   File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 347, in execute
mangadw  |     self.error_handler.check_response(response)
mangadw  |   File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
mangadw  |     raise exception_class(message, screen, stacktrace)
mangadw  | selenium.common.exceptions.WebDriverException: Message: unknown error: session deleted because of page crash
mangadw  | from unknown error: cannot determine loading status
mangadw  | from tab crashed
mangadw  |   (Session info: chrome=123.0.6312.58)
mangadw  | Stacktrace:
mangadw  | #0 0x56114ccd58a3 <unknown>
mangadw  | #1 0x56114c9cb717 <unknown>
mangadw  | #2 0x56114c9b45d3 <unknown>
mangadw  | #3 0x56114c9b3e8a <unknown>
mangadw  | #4 0x56114c9b3638 <unknown>
mangadw  | #5 0x56114c9b3485 <unknown>
mangadw  | #6 0x56114c9b1516 <unknown>
mangadw  | #7 0x56114c9b1b9f <unknown>
mangadw  | #8 0x56114c9c1e65 <unknown>
mangadw  | #9 0x56114c9d764c <unknown>
mangadw  | #10 0x56114c9dcc2b <unknown>
mangadw  | #11 0x56114c9b2222 <unknown>
mangadw  | #12 0x56114c9d7246 <unknown>
mangadw  | #13 0x56114ca56f4a <unknown>
mangadw  | #14 0x56114ca38343 <unknown>
mangadw  | #15 0x56114ca09593 <unknown>
mangadw  | #16 0x56114ca09f5e <unknown>
mangadw  | #17 0x56114cc9988b <unknown>
mangadw  | #18 0x56114cc9d7e5 <unknown>
mangadw  | #19 0x56114cc875b1 <unknown>
mangadw  | #20 0x56114cc9e372 <unknown>
mangadw  | #21 0x56114cc6c8bf <unknown>
mangadw  | #22 0x56114ccc4768 <unknown>
mangadw  | #23 0x56114ccc493b <unknown>
mangadw  | #24 0x56114ccd49f4 <unknown>
mangadw  | #25 0x7f9d9be70134 <unknown>
mangadw  | 
mangadw exited with code 1

And when I try the command once again I have this error this time:

alexandre@MBPdeAlexandre:~/Downloads/Manga_downloader$ docker compose up
[+] Running 1/0
 ✔ Container mangadw  Created                                                                                                                          0.0s 
Attaching to mangadw
mangadw  | [INFO](undetected_chromedriver.patcher) 2024-03-27 12:51:31 : patching driver executable /root/.local/share/undetected_chromedriver/undetected_chromedriver
mangadw  | [INFO](root) 2024-03-27 12:51:33 : Viewport dimensions [784, 1200]
mangadw  | [INFO](root) 2024-03-27 12:51:33 : Find action class, use CmoaJP class.
mangadw  | [INFO](root) 2024-03-27 12:51:33 : Login...
mangadw  | [INFO](root) 2024-03-27 12:51:47 : Login finished...
mangadw  | [INFO](root) 2024-03-27 12:51:47 : Starting download manga 1, imgdir: ~/Downloads/Test/01
mangadw  | Traceback (most recent call last):
mangadw  |   File "main.py", line 43, in <module>
mangadw  |     downloader.download()
mangadw  |   File "/app/downloader.py", line 217, in download
mangadw  |     self.prepare_download(t_img_dir, t_manga_url)
mangadw  |   File "/app/downloader.py", line 138, in prepare_download
mangadw  |     os.mkdir(this_image_dir)
mangadw  | FileNotFoundError: [Errno 2] No such file or directory: '~/Downloads/Test/01'
mangadw exited with code 1

~/Downloads/Test/01 is obviously a folder in my machine but the container doesn't have access to it so it seems the Dockerfile doesn't take into account the destination folders