mirror of
https://github.com/timberjoegithub/GoogleScrape.git
synced 2026-07-22 00:19:48 +00:00
fixing some wordpress posting problems
This commit is contained in:
@@ -1304,6 +1304,7 @@ def post_to_wordpress(title,content,headers,date,rating,address,picslist,outputs
|
|||||||
#contentpics += r'<img src="'+ piclink['link'] + r' alt="' + title +r'">' +'\n\n'
|
#contentpics += r'<img src="'+ piclink['link'] + r' alt="' + title +r'">' +'\n\n'
|
||||||
except AttributeError as error:
|
except AttributeError as error:
|
||||||
print("An error occurred:", type(error).__name__) # An error occurred:
|
print("An error occurred:", type(error).__name__) # An error occurred:
|
||||||
|
return False
|
||||||
try:
|
try:
|
||||||
# print ('featured_media = ',linkslist[0]['file_id'])
|
# print ('featured_media = ',linkslist[0]['file_id'])
|
||||||
if linkslist[0]['file_id']:
|
if linkslist[0]['file_id']:
|
||||||
@@ -1315,6 +1316,7 @@ def post_to_wordpress(title,content,headers,date,rating,address,picslist,outputs
|
|||||||
business_url = business_url_list[0].businessurl
|
business_url = business_url_list[0].businessurl
|
||||||
# wpurllist = outputs['postssession'].query(Posts).filter(Posts.name == title).all()
|
# wpurllist = outputs['postssession'].query(Posts).filter(Posts.name == title).all()
|
||||||
# wpurl = wpurllist[0].wpurl
|
# wpurl = wpurllist[0].wpurl
|
||||||
|
if business_url:
|
||||||
status_message = str(title) + ': Business website: '+ business_url
|
status_message = str(title) + ': Business website: '+ business_url
|
||||||
response_piclinks = requests.post(env.wpAPI+"/posts/"+ str(post_id), \
|
response_piclinks = requests.post(env.wpAPI+"/posts/"+ str(post_id), \
|
||||||
data={"content" : title+' = '+status_message+'\n\n'+content+'\n'+googleadress+'\n'+rating + contentpics,\
|
data={"content" : title+' = '+status_message+'\n\n'+content+'\n'+googleadress+'\n'+rating + contentpics,\
|
||||||
@@ -1324,6 +1326,7 @@ def post_to_wordpress(title,content,headers,date,rating,address,picslist,outputs
|
|||||||
except AttributeError as error:
|
except AttributeError as error:
|
||||||
print(" An error writing images to the post " + post_response.title + ' occurred:', \
|
print(" An error writing images to the post " + post_response.title + ' occurred:', \
|
||||||
type(error).__name__) # An error occurred')
|
type(error).__name__) # An error occurred')
|
||||||
|
return False
|
||||||
return newPost
|
return newPost
|
||||||
|
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
@@ -1391,7 +1394,10 @@ def process_reviews(outputs):
|
|||||||
#if writtento["web"] == 0 :
|
#if writtento["web"] == 0 :
|
||||||
try:
|
try:
|
||||||
post_id, post_link = get_wordpress_post_id_and_link(processrow[1].value,outputs['web'] )
|
post_id, post_link = get_wordpress_post_id_and_link(processrow[1].value,outputs['web'] )
|
||||||
|
if post_link:
|
||||||
database_update_row(processrow[1].value,"wpurl",post_link,"forceall",outputs)
|
database_update_row(processrow[1].value,"wpurl",post_link,"forceall",outputs)
|
||||||
|
else:
|
||||||
|
print (' Error getting wordpress links to update databse')
|
||||||
except AttributeError as error :
|
except AttributeError as error :
|
||||||
print ('Could not check to see post already exists',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].\
|
||||||
|
|||||||
Reference in New Issue
Block a user