aprikyan / google-books-downloader

An open-source utility to scrape Google Books
MIT License
65 stars 14 forks source link

Syntax error #14

Open ghost opened 2 years ago

ghost commented 2 years ago

Hi, I'm stuck at Install, step 2.

$ python --version

Python 2.7.17

$ uname -srm

Linux 4.15.0-20-generic x86_64

$ sudo -H /usr/local/bin/pip3 install -r requirements.txt

Requirement already satisfied: regex in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 1)) (2021.3.17) Requirement already satisfied: progressbar in /usr/lib/python3/dist-packages (from -r requirements.txt (line 2)) (2.3) Requirement already satisfied: selenium==3.141.0 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 3)) (3.141.0) Collecting selenium-wire>=2.1.0 Downloading selenium_wire-4.6.2-py3-none-any.whl (238 kB) |████████████████████████████████| 238 kB 2.1 MB/s
Requirement already satisfied: urllib3 in /usr/lib/python3/dist-packages (from selenium==3.141.0->-r requirements.txt (line 3)) (1.22) Collecting dataclasses>=0.7 Downloading dataclasses-0.8-py3-none-any.whl (19 kB) Collecting kaitaistruct>=0.7 Downloading kaitaistruct-0.9.tar.gz (5.5 kB) Preparing metadata (setup.py) ... done Collecting zstandard>=0.14.1 Downloading zstandard-0.17.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.5 MB) |████████████████████████████████| 2.5 MB 436 kB/s
Collecting pyparsing>=2.4.2 Downloading pyparsing-3.0.7-py3-none-any.whl (98 kB) |████████████████████████████████| 98 kB 885 kB/s
Requirement already satisfied: pysocks>=1.7.1 in /usr/local/lib/python3.6/dist-packages (from selenium-wire>=2.1.0->-r requirements.txt (line 4)) (1.7.1) Collecting h2>=4.0 Downloading h2-4.1.0-py3-none-any.whl (57 kB) |████████████████████████████████| 57 kB 581 kB/s
Collecting pyOpenSSL>=19.1.0 Downloading pyOpenSSL-22.0.0-py2.py3-none-any.whl (55 kB) |████████████████████████████████| 55 kB 471 kB/s
Collecting brotli>=1.0.9 Downloading Brotli-1.0.9-cp36-cp36m-manylinux1_x86_64.whl (357 kB) |████████████████████████████████| 357 kB 3.3 MB/s
Requirement already satisfied: blinker>=1.4 in /usr/lib/python3/dist-packages (from selenium-wire>=2.1.0->-r requirements.txt (line 4)) (1.4) Collecting wsproto>=0.14 Downloading wsproto-1.0.0-py3-none-any.whl (24 kB) Collecting hyperframe>=6.0 Downloading hyperframe-6.0.1-py3-none-any.whl (12 kB) Requirement already satisfied: pyasn1>=0.3.1 in /usr/lib/python3/dist-packages (from selenium-wire>=2.1.0->-r requirements.txt (line 4)) (0.4.2) Collecting certifi>=2019.9.11 Downloading certifi-2021.10.8-py2.py3-none-any.whl (149 kB) |████████████████████████████████| 149 kB 3.7 MB/s
Collecting hpack<5,>=4.0 Downloading hpack-4.0.0-py3-none-any.whl (32 kB) Collecting cryptography>=35.0 Downloading cryptography-36.0.1-cp36-abi3-manylinux_2_24_x86_64.whl (3.6 MB) |████████████████████████████████| 3.6 MB 2.4 MB/s
Collecting h11<1,>=0.9.0 Downloading h11-0.13.0-py3-none-any.whl (58 kB) |████████████████████████████████| 58 kB 779 kB/s
Collecting cffi>=1.12 Downloading cffi-1.15.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (405 kB) |████████████████████████████████| 405 kB 3.1 MB/s
Collecting typing-extensions Downloading typing_extensions-4.1.1-py3-none-any.whl (26 kB) Collecting pycparser Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB) |████████████████████████████████| 118 kB 2.7 MB/s
Using legacy 'setup.py install' for kaitaistruct, since package 'wheel' is not installed. Installing collected packages: pycparser, typing-extensions, dataclasses, cffi, hyperframe, hpack, h11, cryptography, zstandard, wsproto, pyparsing, pyOpenSSL, kaitaistruct, h2, certifi, brotli, selenium-wire Attempting uninstall: cryptography Found existing installation: cryptography 2.1.4 Uninstalling cryptography-2.1.4: Successfully uninstalled cryptography-2.1.4 Running setup.py install for kaitaistruct ... done Attempting uninstall: certifi Found existing installation: certifi 2018.1.18 Uninstalling certifi-2018.1.18: Successfully uninstalled certifi-2018.1.18 Successfully installed brotli-1.0.9 certifi-2021.10.8 cffi-1.15.0 cryptography-36.0.1 dataclasses-0.8 h11-0.13.0 h2-4.1.0 hpack-4.0.0 hyperframe-6.0.1 kaitaistruct-0.9 pyOpenSSL-22.0.0 pycparser-2.21 pyparsing-3.0.7 selenium-wire-4.6.2 typing-extensions-4.1.1 wsproto-1.0.0 zstandard-0.17.0 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

$ apt list --installed | grep chrome

WARNING: apt does not have a stable CLI interface. Use with caution in scripts. chromium-chromedriver/bionic-updates,bionic-security,now 97.0.4692.71-0ubuntu0.18.04.1 amd64 [installed]

$ python gbd.py

File "gbd.py", line 34 return (f"https://books.google.com/books?{id_part}&pg=1&hl=en#v=onepage&q&f=false", ^ > SyntaxError: invalid syntax

$ cat gbd.py | grep '.exe'

driver = webdriver.Chrome("chromedriver.exe", options=chrome_options)

$ sed -iE '/chromedriver\.exe/ s/\.exe//' gbd.py

$ cat gbd.py | grep 'chromedriver'

driver = webdriver.Chrome("chromedriver", options=chrome_options)