Linh Vuu commited on
Commit
3f1beca
·
1 Parent(s): 9335b14

updated requirements

Browse files
Files changed (2) hide show
  1. requirements.txt +2 -1
  2. scraper_shopee.py +15 -8
requirements.txt CHANGED
@@ -1,4 +1,5 @@
1
  selenium==4.3.0
2
  pandas==1.2
3
  streamlit==1.13.0
4
- altair==4.2.0
 
 
1
  selenium==4.3.0
2
  pandas==1.2
3
  streamlit==1.13.0
4
+ altair==4.2.0
5
+ webdriver-manager==3.7.1
scraper_shopee.py CHANGED
@@ -1,8 +1,8 @@
1
  from selenium import webdriver
2
- from selenium.webdriver.chrome.options import Options
 
3
  from selenium.common.exceptions import NoSuchElementException
4
  from selenium.webdriver.common.by import By
5
- from selenium.webdriver.support.ui import WebDriverWait
6
  from selenium.webdriver.support import expected_conditions as EC
7
  import time
8
 
@@ -24,12 +24,19 @@ def start_driver(force_restart=False):
24
  close_driver()
25
 
26
  # Setting up the driver
27
- options = Options()
28
- options.add_argument('-headless') # we don't want a chrome browser opens, so it will run in the background
29
- options.add_argument('-no-sandbox')
30
- options.add_argument('-disable-dev-shm-usage')
31
-
32
- DRIVER = webdriver.Chrome(options=options)
 
 
 
 
 
 
 
33
 
34
  ### Function to extract product info from the necessary html and json tags
35
  def get_shopee_product_info_single(product_element, extra_info):
 
1
  from selenium import webdriver
2
+ from webdriver_manager.chrome import ChromeDriverManager
3
+ # from selenium.webdriver.chrome.options import Options
4
  from selenium.common.exceptions import NoSuchElementException
5
  from selenium.webdriver.common.by import By
 
6
  from selenium.webdriver.support import expected_conditions as EC
7
  import time
8
 
 
24
  close_driver()
25
 
26
  # Setting up the driver
27
+ # options = Options()
28
+ # options.add_argument('-headless') # we don't want a chrome browser opens, so it will run in the background
29
+ # options.add_argument('-no-sandbox')
30
+ # options.add_argument('-disable-dev-shm-usage')
31
+
32
+ # DRIVER = webdriver.Chrome(options=options)
33
+
34
+ gChromeOptions = webdriver.ChromeOptions()
35
+ gChromeOptions.add_argument("window-size=1920x1480")
36
+ gChromeOptions.add_argument("disable-dev-shm-usage")
37
+ DRIVER = webdriver.Chrome(
38
+ chrome_options=gChromeOptions, executable_path=ChromeDriverManager().install()
39
+ )
40
 
41
  ### Function to extract product info from the necessary html and json tags
42
  def get_shopee_product_info_single(product_element, extra_info):