mirror of
https://github.com/timberjoegithub/GoogleScrape.git
synced 2026-07-22 00:19:48 +00:00
working on wpurl
This commit is contained in:
@@ -399,7 +399,7 @@ def get_google_data(driver,outputs ):
|
|||||||
database_update_row(name,"googleurl",googleurl,"onlyempty",outputs)
|
database_update_row(name,"googleurl",googleurl,"onlyempty",outputs)
|
||||||
database_update_row(name,"place_id",place_id,"onlyempty",outputs)
|
database_update_row(name,"place_id",place_id,"onlyempty",outputs)
|
||||||
database_update_row(name,"googledetails",details,"onlyempty",outputs)
|
database_update_row(name,"googledetails",details,"onlyempty",outputs)
|
||||||
database_update_row(name,"google",1,"onlyempty",outputs)
|
database_update_row(name,"google","1","onlyempty",outputs)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print('Error writing business details from google maps : ',error)
|
print('Error writing business details from google maps : ',error)
|
||||||
else:
|
else:
|
||||||
@@ -602,6 +602,21 @@ def check_is_port_open(host, port):
|
|||||||
|
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
def get_wordpress_post_id_and_link(postname,headers2):
|
||||||
|
response = requests.get(env.wpAPI+"/posts?search="+postname, headers=headers2,timeout=40)
|
||||||
|
result = response.json()
|
||||||
|
if len(result) > 0 :
|
||||||
|
post_id = int(result[0]['id'])
|
||||||
|
post_date = result[0]['date']
|
||||||
|
post_link = result[0]['link']
|
||||||
|
return post_id, post_link
|
||||||
|
else:
|
||||||
|
print('No existing post with same name: ' + postname)
|
||||||
|
return False, False
|
||||||
|
|
||||||
|
##################################################################################################
|
||||||
|
|
||||||
def check_wordpress_post(postname,postdate,headers2):
|
def check_wordpress_post(postname,postdate,headers2):
|
||||||
response = requests.get(env.wpAPI+"/posts?search="+postname, headers=headers2,timeout=40)
|
response = requests.get(env.wpAPI+"/posts?search="+postname, headers=headers2,timeout=40)
|
||||||
result = response.json()
|
result = response.json()
|
||||||
@@ -1170,6 +1185,11 @@ def process_reviews(outputs):
|
|||||||
env.threads or env.google)and (processrow[2].value is not None) :
|
env.threads or env.google)and (processrow[2].value is not None) :
|
||||||
if env.web :
|
if env.web :
|
||||||
#if writtento["web"] == 0 :
|
#if writtento["web"] == 0 :
|
||||||
|
try:
|
||||||
|
post_id, post_link = get_wordpress_post_id_and_link(processrow[1].value,outputs['web'] )
|
||||||
|
database_update_row(processrow[1].value,"wpurl",post_link,"forceall",outputs)
|
||||||
|
except Exception as error :
|
||||||
|
print ('Could not check to see post already exists',error)
|
||||||
if outputs['postssession'].query(Posts).filter(Posts.name == processrow[1].\
|
if outputs['postssession'].query(Posts).filter(Posts.name == processrow[1].\
|
||||||
value,Posts.web != 1):
|
value,Posts.web != 1):
|
||||||
if webcount < env.postsperrun:
|
if webcount < env.postsperrun:
|
||||||
|
|||||||
Reference in New Issue
Block a user