mirror of
https://github.com/leoncvlt/loconotion.git
synced 2024-08-30 18:12:12 +00:00
13
README.md
13
README.md
@ -61,6 +61,19 @@ This script uses [ChromeDriver](chromedriver.chromium.org) to automate the Googl
|
||||
|
||||
The script will automatically try to download and use the appropriate chromedriver distribution for your OS and Chrome version. If this doesn't work, download the right version for you from https://chromedriver.chromium.org/downloads and use the `--chromedriver` argument to specify its path at runtime.
|
||||
|
||||
### Docker support
|
||||
|
||||
There is a Docker support also. To build a container and to render the page run:
|
||||
```bash
|
||||
# Build container with loconotion
|
||||
$ docker-compose build loconotion
|
||||
|
||||
# Run loconotion renderer with any arguments
|
||||
$ docker-compose run loconotion PATH_TO_NOTION_FILE [ARGS]
|
||||
```
|
||||
|
||||
Docker container is built from `python:3.8` tag, there is google-chrome-stable and chromedriver installed. See more in [docker/Dockerfile](docker/Dockerfile).
|
||||
|
||||
## Simple Usage
|
||||
|
||||
`python loconotion https://www.notion.so/The-perfect-It-s-Always-Sunny-in-Philadelphia-episode-d08aaec2b24946408e8be0e9f2ae857e`
|
||||
|
11
docker-compose.yml
Normal file
11
docker-compose.yml
Normal file
@ -0,0 +1,11 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
loconotion:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/Dockerfile
|
||||
image: loconotion:latest
|
||||
volumes:
|
||||
- ${LOCONOTION_LOCAL_DIST:-/tmp/}:/app/loconotion/dist
|
||||
restart: always
|
32
docker/Dockerfile
Normal file
32
docker/Dockerfile
Normal file
@ -0,0 +1,32 @@
|
||||
FROM python:3.8
|
||||
|
||||
# ChromeDriver installation from https://gist.github.com/varyonic/dea40abcf3dd891d204ef235c6e8dd79
|
||||
# We need wget to set up the PPA and xvfb to have a virtual screen and unzip to install the Chromedriver
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y libgconf-2-4 wget xvfb unzip
|
||||
# Set up the Chrome PPA
|
||||
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
|
||||
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
|
||||
# Update the package list and install chrome
|
||||
RUN apt-get update -y
|
||||
RUN apt-get install -y google-chrome-stable
|
||||
|
||||
# RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||
# RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install
|
||||
# Set up Chromedriver Environment variables
|
||||
ENV CHROMEDRIVER_VERSION 85.0.4183.38
|
||||
ENV CHROMEDRIVER_DIR /chromedriver
|
||||
RUN mkdir $CHROMEDRIVER_DIR
|
||||
# Download and install Chromedriver
|
||||
RUN wget -q --continue -P $CHROMEDRIVER_DIR "https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip"
|
||||
RUN unzip $CHROMEDRIVER_DIR/chromedriver* -d $CHROMEDRIVER_DIR
|
||||
# Put Chromedriver into the PATH
|
||||
ENV PATH $CHROMEDRIVER_DIR:$PATH
|
||||
|
||||
RUN mkdir -p /app/loconotion/
|
||||
WORKDIR /app/loconotion/
|
||||
COPY requirements.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
ENTRYPOINT [ "python", "loconotion", "--chromedriver", "/chromedriver/chromedriver"]
|
@ -228,6 +228,8 @@ class Parser:
|
||||
if not self.args.get("non_headless", False):
|
||||
chrome_options.add_argument("--headless")
|
||||
chrome_options.add_argument("window-size=1920,1080")
|
||||
chrome_options.add_argument('--no-sandbox')
|
||||
chrome_options.add_argument('--disable-dev-shm-usage')
|
||||
chrome_options.add_argument("--log-level=3")
|
||||
chrome_options.add_argument("--silent")
|
||||
chrome_options.add_argument("--disable-logging")
|
||||
|
Reference in New Issue
Block a user