mirror of
https://github.com/timberjoegithub/GoogleScrape.git
synced 2026-07-22 00:19:48 +00:00
working on wpurl, need to clean DB, got dup records
This commit is contained in:
@@ -660,7 +660,7 @@ def get_wordpress_post_id_and_link(postname,headers2):
|
|||||||
result = response.json()
|
result = response.json()
|
||||||
if len(result) > 0 :
|
if len(result) > 0 :
|
||||||
post_id = int(result[0]['id'])
|
post_id = int(result[0]['id'])
|
||||||
post_date = result[0]['date']
|
# post_date = result[0]['date']
|
||||||
post_link = result[0]['link']
|
post_link = result[0]['link']
|
||||||
return post_id, post_link
|
return post_id, post_link
|
||||||
else:
|
else:
|
||||||
@@ -1249,7 +1249,7 @@ def process_reviews(outputs):
|
|||||||
new_web_post=post_to_wordpress(processrow[1].value,processrow[2].\
|
new_web_post=post_to_wordpress(processrow[1].value,processrow[2].\
|
||||||
value,outputs['web'] ,processrow[7].value, processrow[3].value\
|
value,outputs['web'] ,processrow[7].value, processrow[3].value\
|
||||||
, processrow[8].value, processrow[5].value,outputs)
|
, processrow[8].value, processrow[5].value,outputs)
|
||||||
print (' Success Posting to Wordpress: '+processrow[1].value)# ',processrow[1].value, processrow[2].value, headers,processrow[7].value, processrow[3].value,processrow[8].value, processrow[5].value, temp3["web"] )
|
print (' Success Posting to Wordpress: '+processrow[1].value)
|
||||||
if new_web_post:
|
if new_web_post:
|
||||||
webcount +=1
|
webcount +=1
|
||||||
try:
|
try:
|
||||||
@@ -1257,20 +1257,17 @@ def process_reviews(outputs):
|
|||||||
outputs['datawb'].save(env.xls)
|
outputs['datawb'].save(env.xls)
|
||||||
print(' Successfully updated spreadsheet')
|
print(' Successfully updated spreadsheet')
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print(" An error occurred writing Excel file:", type(error).__name__) # An error occurred: try:
|
print(" An error occurred writing Excel file:", type(error).__name__)
|
||||||
try:
|
try:
|
||||||
print(' write to DB for web')
|
print(' write to DB for web')
|
||||||
outputs['postssession'].query(Posts).filter(Posts.name == processrow[1].value).update({"web" : 1})
|
outputs['postssession'].query(Posts).filter(Posts.name == processrow[1].value).update({"web" : 1})
|
||||||
outputs['postssession'].commit()
|
outputs['postssession'].commit()
|
||||||
print(' Successfully wrote to database')
|
print(' Successfully wrote to database')
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print(" An error occurred writing database", type(error).__name__) # An error occurred:
|
print(" An error occurred writing database", type(error).__name__)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print (' Error writing web post : ',processrow[1].value, processrow[2].value,processrow[7].value, processrow[3].value,processrow[8].value, processrow[5].value, writtento["web"])
|
|
||||||
print (error) #print (' Error writing web post : ',processrow[1].value, processrow[2].value, outputs['web'],processrow[7].value, processrow[3].value,processrow[8].value, processrow[5].value, writtento["web"] )
|
|
||||||
print (' Error writing web post : ',processrow[1].value, processrow[2].value,processrow[7].value, processrow[3].value,processrow[8].value, processrow[5].value, writtento["web"],' ',error)
|
print (' Error writing web post : ',processrow[1].value, processrow[2].value,processrow[7].value, processrow[3].value,processrow[8].value, processrow[5].value, writtento["web"],' ',error)
|
||||||
print (error)
|
print (error)
|
||||||
#print (' Error writing web post : ',processrow[1].value, processrow[2].value, outputs['web'],processrow[7].value, processrow[3].value,processrow[8].value, processrow[5].value, writtento["web"] )
|
|
||||||
else:
|
else:
|
||||||
print (' Exceeded the number of web posts per run, skipping', processrow[1].value)
|
print (' Exceeded the number of web posts per run, skipping', processrow[1].value)
|
||||||
else:
|
else:
|
||||||
@@ -1287,7 +1284,7 @@ def process_reviews(outputs):
|
|||||||
processrow[9].value = str(writtento)
|
processrow[9].value = str(writtento)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print(" An error occurred setting value to go into Excel file:", type(error).__name__)
|
print(" An error occurred setting value to go into Excel file:", type(error).__name__)
|
||||||
print (' Success Posting to Instagram: '+processrow[1].value)# ',processrow[1].value, processrow[2].value, headers,processrow[7].value, processrow[3].value,processrow[8].value, processrow[5].value, temp3["web"] )
|
print (' Success Posting to Instagram: '+processrow[1].value)
|
||||||
if NewInstagramPost:
|
if NewInstagramPost:
|
||||||
instagramcount +=1
|
instagramcount +=1
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user