mirror of
https://github.com/timberjoegithub/GoogleScrape.git
synced 2026-07-22 00:19:48 +00:00
Twitter v2 updates
This commit is contained in:
@@ -743,14 +743,17 @@ def post_x2(title, content, date, rating, address, picslist, instasession):
|
|||||||
# Replace the following strings with your own keys and secrets
|
# Replace the following strings with your own keys and secrets
|
||||||
CONSUMER_KEY = env.consumer_key
|
CONSUMER_KEY = env.consumer_key
|
||||||
CONSUMER_SECRET = env.consumer_secret
|
CONSUMER_SECRET = env.consumer_secret
|
||||||
ACCESS_TOKEN = access_token
|
ACCESS_TOKEN = env.access_token
|
||||||
ACCESS_TOKEN_SECRET = access_token_secret
|
ACCESS_TOKEN_SECRET = env.access_token_secret
|
||||||
# Authenticate to Twitter
|
# Authenticate to Twitter
|
||||||
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
|
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
|
||||||
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
|
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
|
||||||
# Create an API object to use the Twitter API
|
# Create an API object to use the Twitter API
|
||||||
api = tweepy.API(auth)
|
api = tweepy.API(auth)
|
||||||
img_list = pics
|
img_list = pics
|
||||||
|
imgs_vid = []
|
||||||
|
imgs_pic = []
|
||||||
|
#imgs_id = []
|
||||||
for img in img_list:
|
for img in img_list:
|
||||||
if 'montage.mp4' in img:
|
if 'montage.mp4' in img:
|
||||||
imgs_vid.append(img.strip())
|
imgs_vid.append(img.strip())
|
||||||
@@ -759,10 +762,10 @@ def post_x2(title, content, date, rating, address, picslist, instasession):
|
|||||||
if imgs_vid:
|
if imgs_vid:
|
||||||
# print ("loop")
|
# print ("loop")
|
||||||
try:
|
try:
|
||||||
post_id = postVideo(group_id, imgs_vid,auth_token,title, content,
|
# post_id = postVideo(group_id, imgs_vid,auth_token,title, content,
|
||||||
date, rating, address)
|
# date, rating, address)
|
||||||
imgs_id.append(post_id['id'])
|
# imgs_id.append(post_id['id'])
|
||||||
video_path = imgs+vid[0]
|
video_path = imgs_vid[0]
|
||||||
# Path to the video you want to upload
|
# Path to the video you want to upload
|
||||||
#video_path = 'path_to_video.mp4'
|
#video_path = 'path_to_video.mp4'
|
||||||
# Message to post along with the video
|
# Message to post along with the video
|
||||||
@@ -1334,10 +1337,10 @@ def process_reviews(outputs):
|
|||||||
if xtwittercount <= env.postsperrun:
|
if xtwittercount <= env.postsperrun:
|
||||||
try:
|
try:
|
||||||
print(' Starting to generate xtwitter post')
|
print(' Starting to generate xtwitter post')
|
||||||
NewxtwitterPost = post_x2(processrow[1].value, processrow[2].value, processrow[7].value, processrow[3].value, processrow[8].value, processrow[5].value,outputs['xtwitter'] )
|
NewxtwitterPost = post_x2(processrow[1].value, processrow[2].value, processrow[7].value, processrow[3].value, processrow[8].value, processrow[5].value,outputs['posts'] )
|
||||||
try:
|
try:
|
||||||
print (' Start generating content to post to xtwitter')
|
print (' Start generating content to post to xtwitter')
|
||||||
writtento["facebook"] = 1
|
writtento["xtwitter"] = 1
|
||||||
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__) # An error occurred:
|
print(" An error occurred setting value to go into Excel file:", type(error).__name__) # An error occurred:
|
||||||
@@ -1353,7 +1356,7 @@ def process_reviews(outputs):
|
|||||||
except Exception as error:
|
except Exception as error:
|
||||||
print(" An error occurred writing Excel file:", type(error).__name__) # An error occurred:
|
print(" An error occurred writing Excel file:", type(error).__name__) # An error occurred:
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print (' Error writing xtwitter post : ',processrow[1].value, processrow[2].value, outputs,processrow[7].value, processrow[3].value,processrow[8].value, processrow[5].value, writtento["xtwitter"], type(error).__name__ )
|
print (' Error writing xtwitter post : ',error,processrow[1].value, processrow[2].value, outputs,processrow[7].value, processrow[3].value,processrow[8].value, processrow[5].value, writtento["xtwitter"], type(error).__name__ )
|
||||||
else:
|
else:
|
||||||
print (' Exceeded the number of xtwitter posts per run, skipping', processrow[1].value)
|
print (' Exceeded the number of xtwitter posts per run, skipping', processrow[1].value)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user