mirror of
https://github.com/timberjoegithub/GoogleScrape.git
synced 2026-07-22 00:19:48 +00:00
oo
This commit is contained in:
@@ -1328,17 +1328,17 @@ def post_to_wordpress(title, content, headers,date, rating,address, picslist):
|
|||||||
except Exception as error:
|
except Exception as error:
|
||||||
print("An error occurred:", type(error).__name__) # An error occurred:
|
print("An error occurred:", type(error).__name__) # An error occurred:
|
||||||
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']:
|
||||||
print ('featuredmedia2 = ',linkslist[0]['file_id'])
|
print ('featuredmedia2 = ',linkslist[0]['file_id'])
|
||||||
else:
|
else:
|
||||||
fmedia = file_id
|
fmedia = file_id
|
||||||
print ('featured_media2 = ',file_id)
|
# print ('featured_media2 = ',file_id)
|
||||||
response_piclinks = requests.post(env.wpAPI+"/posts/"+ str(post_id), \
|
response_piclinks = requests.post(env.wpAPI+"/posts/"+ str(post_id), \
|
||||||
data={"content" : title+' = '+content+'\n'+googleadress+'\n'+rating + contentpics,\
|
data={"content" : title+' = '+content+'\n'+googleadress+'\n'+rating + contentpics,\
|
||||||
"featured_media" : fmedia,"rank_math_focus_keyword" : title }, headers=headers,\
|
"featured_media" : fmedia,"rank_math_focus_keyword" : title }, headers=headers,\
|
||||||
timeout=30)
|
timeout=30)
|
||||||
print (response_piclinks)
|
print (' ',response_piclinks)
|
||||||
except Exception as error:
|
except Exception 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')
|
||||||
|
|||||||
Reference in New Issue
Block a user