-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathapi-example.py
41 lines (35 loc) · 1.76 KB
/
api-example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- coding:utf-8 -*-
"""
Verion: 1.0
Author: Helixcs
File: example.py
Time: 2019/12/15
You should install `google-chrome` at first when used in Linux
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt-get update
sudo apt-get install google-chrome-stable
"""
from selenium.webdriver import ChromeOptions
from api import GoogleArtsCrawlerProcess, GoogleArtsCrawlerOption
if __name__ == '__main__':
chrome_option = ChromeOptions()
chrome_option.add_argument("--headless")
chrome_option.add_argument('--no-sandbox')
chrome_option.add_argument('--disable-dev-shm-usage')
chrome_option.add_argument('--disable-gpu')
chrome_option.add_argument("--disable-dev-shm-usage")
chrome_option.add_argument("start-maximized")
chrome_option.add_argument("disable-infobars")
chrome_option.add_argument("--disable-extensions")
GoogleArtsCrawlerProcess(gaco=GoogleArtsCrawlerOption()
.set_url("https://artsandculture.google.com/asset/madame-moitessier/hQFUe-elM1npbw")
.set_chrome_options(chrome_option)
.set_need_download_webdrive(True)
# .set_webdriver_execute_path("webdriver/chromedriver")
.set_partial_tmp_path("custom_partial_dir")
.set_output_path("custom_output_dir")
.set_output_filename("custom.jpg")
.set_need_clear_cache(True)
.set_debug(True)
.prepare_options()).process()