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 sqlalchemy
|
||||||
import env
|
|
||||||
|
|
||||||
#data
|
#data
|
||||||
import time
|
import time
|
||||||
@@ -36,9 +35,12 @@ import instagrapi
|
|||||||
from moviepy.editor import VideoFileClip, concatenate_videoclips
|
from moviepy.editor import VideoFileClip, concatenate_videoclips
|
||||||
#import moviepy
|
#import moviepy
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
#import mysqlclient
|
#import mysqlclient
|
||||||
#import mysql-connector-python
|
#import mysql-connector-python
|
||||||
|
import env
|
||||||
Base = declarative_base()
|
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):
|
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/'
|
#msg = 'Purple Ombre Bob Lace Wig Natural Human Hair now available on https://lace-wigs.co.za/'
|
||||||
pics = ((picslist[1:-1].replace(",","")).replace("'","")).split(" ")
|
pics = ((picslist[1:-1].replace(",","")).replace("'","")).split(" ")
|
||||||
@@ -1008,6 +1016,9 @@ def process_reviews(outputs):
|
|||||||
caps['acceptSslCerts'] = True
|
caps['acceptSslCerts'] = True
|
||||||
options.set_capability('cloud:options', caps)
|
options.set_capability('cloud:options', caps)
|
||||||
#driver = webdriver.Chrome(desired_capabilities=caps)
|
#driver = webdriver.Chrome(desired_capabilities=caps)
|
||||||
|
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)
|
driver = webdriver.Chrome(options=options) # Firefox(options=options)
|
||||||
# Changing the property of the navigator value for webdriver to undefined
|
# Changing the property of the navigator value for webdriver to undefined
|
||||||
driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})")
|
driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})")
|
||||||
|
|||||||
Reference in New Issue
Block a user