mirror of
https://github.com/timberjoegithub/GoogleScrape.git
synced 2026-07-22 00:19:48 +00:00
added docker remote browser support
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import sqlalchemy
|
||||
import env
|
||||
|
||||
#data
|
||||
import time
|
||||
@@ -36,9 +35,12 @@ import instagrapi
|
||||
from moviepy.editor import VideoFileClip, concatenate_videoclips
|
||||
#import moviepy
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
#import mysqlclient
|
||||
#import mysql-connector-python
|
||||
import env
|
||||
Base = declarative_base()
|
||||
|
||||
##################################################################################################
|
||||
@@ -178,6 +180,12 @@ def counter(driver):
|
||||
|
||||
##################################################################################################
|
||||
|
||||
def is_docker():
|
||||
cgroup = Path('/proc/self/cgroup')
|
||||
return Path('/.dockerenv').is_file() or cgroup.is_file() and 'docker' in cgroup.read_text()
|
||||
|
||||
##################################################################################################
|
||||
|
||||
def post_facebook(title, content, date, rating, address, picslist, instasession):
|
||||
#msg = 'Purple Ombre Bob Lace Wig Natural Human Hair now available on https://lace-wigs.co.za/'
|
||||
pics = ((picslist[1:-1].replace(",","")).replace("'","")).split(" ")
|
||||
@@ -1008,7 +1016,10 @@ def process_reviews(outputs):
|
||||
caps['acceptSslCerts'] = True
|
||||
options.set_capability('cloud:options', caps)
|
||||
#driver = webdriver.Chrome(desired_capabilities=caps)
|
||||
driver = webdriver.Chrome(options=options) # Firefox(options=options)
|
||||
if is_docker :
|
||||
driver = webdriver.Remote("http://192.168.10.6:4444/wd/hub", options=options)
|
||||
else:
|
||||
driver = webdriver.Chrome(options=options) # Firefox(options=options)
|
||||
# Changing the property of the navigator value for webdriver to undefined
|
||||
driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})")
|
||||
driver.get(env.URL)
|
||||
|
||||
Reference in New Issue
Block a user