mirror of
https://github.com/timberjoegithub/GoogleScrape.git
synced 2026-07-22 00:19:48 +00:00
started tiktok
This commit is contained in:
Binary file not shown.
@@ -500,6 +500,7 @@ def get_google_data(driver, local_outputs):
|
|||||||
print('Error writing business details from google maps : ',error)
|
print('Error writing business details from google maps : ',error)
|
||||||
else:
|
else:
|
||||||
print (' Post was already in database, skipping update unless you activate override')
|
print (' Post was already in database, skipping update unless you activate override')
|
||||||
|
if env.forcegoogleupdate:
|
||||||
database_update_row(name,"google",True,"forceall",local_outputs)
|
database_update_row(name,"google",True,"forceall",local_outputs)
|
||||||
pics= []
|
pics= []
|
||||||
pics2 = []
|
pics2 = []
|
||||||
@@ -565,6 +566,7 @@ def get_google_data(driver, local_outputs):
|
|||||||
'instagram':0,'tiktok':0}
|
'instagram':0,'tiktok':0}
|
||||||
lst_data.append([name , text, score,pics,pics2,"GoogleMaps",visitdate,address,
|
lst_data.append([name , text, score,pics,pics2,"GoogleMaps",visitdate,address,
|
||||||
dict_post_complete])
|
dict_post_complete])
|
||||||
|
if env.force_web_create:
|
||||||
database_update_row(name,"visitdate",visitdate,"forceall",local_outputs)
|
database_update_row(name,"visitdate",visitdate,"forceall",local_outputs)
|
||||||
return lst_data
|
return lst_data
|
||||||
|
|
||||||
@@ -1121,8 +1123,8 @@ def post_to_threads2(title, content, headers, date, rating, address, picslist, l
|
|||||||
Returns:
|
Returns:
|
||||||
bool: True if the post was successfully uploaded to Instagram, False otherwise.
|
bool: True if the post was successfully uploaded to Instagram, False otherwise.
|
||||||
"""
|
"""
|
||||||
|
pics = ((picslist[1:-1]).replace("'","")).split(",")
|
||||||
if picslist != '[]' and "montage.mp4" in picslist:
|
if pics != '[]' and "montage.mp4" in pics:
|
||||||
outputmontage = ''
|
outputmontage = ''
|
||||||
addresshtml = re.sub(" ", ".",address)
|
addresshtml = re.sub(" ", ".",address)
|
||||||
#content = content + get_hastags(address, title)
|
#content = content + get_hastags(address, title)
|
||||||
@@ -1192,10 +1194,13 @@ def post_to_tiktok(title, content, headers, date, rating, address, picslist, loc
|
|||||||
# If you want to schedule your video, replace 'schedule_timestamp' with the Unix timestamp.
|
# If you want to schedule your video, replace 'schedule_timestamp' with the Unix timestamp.
|
||||||
# Leave it as None if you want to upload immediately.
|
# Leave it as None if you want to upload immediately.
|
||||||
schedule_time = None # or Unix timestamp (e.g., 1672592400)
|
schedule_time = None # or Unix timestamp (e.g., 1672592400)
|
||||||
if picslist != '[]' and "montage.mp4" in picslist:
|
pics = ((picslist[1:-1]).replace("'","")).split(",")
|
||||||
for pic in picslist:
|
if any(element.endswith("montage.mp4") for element in pics):
|
||||||
|
for pic in pics:
|
||||||
if 'montage.mp4' in pic:
|
if 'montage.mp4' in pic:
|
||||||
file_path = pic
|
file_path = pic
|
||||||
|
else:
|
||||||
|
return False
|
||||||
#content = content + get_hastags(address, title)
|
#content = content + get_hastags(address, title)
|
||||||
#pics = ((picslist[1:-1].replace(",","")).replace("'","")).split(" ")
|
#pics = ((picslist[1:-1].replace(",","")).replace("'","")).split(" ")
|
||||||
# video, outputmontage = make_montage_video_from_google(pics)
|
# video, outputmontage = make_montage_video_from_google(pics)
|
||||||
@@ -1225,16 +1230,58 @@ def post_to_tiktok(title, content, headers, date, rating, address, picslist, loc
|
|||||||
# --data-urlencode 'grant_type=authorization_code' \
|
# --data-urlencode 'grant_type=authorization_code' \
|
||||||
# --data-urlencode 'redirect_uri=REDIRECT_URI'
|
# --data-urlencode 'redirect_uri=REDIRECT_URI'
|
||||||
# """
|
# """
|
||||||
|
|
||||||
|
# curl --location 'https://open.tiktokapis.com/v2/post/publish/inbox/video/init/' \
|
||||||
|
# --header 'Authorization: Bearer act.example12345Example12345Example' \
|
||||||
|
# --header 'Content-Type: application/json; charset=UTF-8'
|
||||||
|
# --data '{
|
||||||
|
# "source_info": {
|
||||||
|
# "source": "FILE_UPLOAD",
|
||||||
|
# "video_size": exampleVideoSize,
|
||||||
|
# "chunk_size" : exampleChunkSize,
|
||||||
|
# "total_chunk_count": exampleTotalChunkCount
|
||||||
|
# }
|
||||||
|
# }'
|
||||||
|
|
||||||
|
|
||||||
|
# curl --location 'https://open.tiktokapis.com/v2/post/publish/video/init/' \
|
||||||
|
# --header 'Authorization: Bearer act.example12345Example12345Example' \
|
||||||
|
# --header 'Content-Type: application/json; charset=UTF-8' \
|
||||||
|
# --data-raw '{
|
||||||
|
# "post_info": {
|
||||||
|
# "title": "this will be a funny #cat video on your @tiktok #fyp",
|
||||||
|
# "privacy_level": "MUTUAL_FOLLOW_FRIENDS",
|
||||||
|
# "disable_duet": false,
|
||||||
|
# "disable_comment": true,
|
||||||
|
# "disable_stitch": false,
|
||||||
|
# "video_cover_timestamp_ms": 1000
|
||||||
|
# },
|
||||||
|
# "source_info": {
|
||||||
|
# "source": "FILE_UPLOAD",
|
||||||
|
# "video_size": 50000123,
|
||||||
|
# "chunk_size": 10000000,
|
||||||
|
# "total_chunk_count": 5
|
||||||
|
# }
|
||||||
|
# }'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
headers = ['Content-Type: application/x-www-form-urlencoded','Cache-Control: no-cache']
|
headers = ['Content-Type: application/x-www-form-urlencoded','Cache-Control: no-cache']
|
||||||
data = ['client_key='+env.tiktok_client_key,'client_secret='+env.tiktok_client_secret,\
|
data = ['client_key='+env.tiktok_client_key,'client_secret='+env.tiktok_client_secret,\
|
||||||
'code=CODE','grant_type=authorization_code','redirect_uri=REDIRECT_URI']
|
'code='+env.tiktok_app_id,'grant_type=authorization_code','redirect_uri=http://www.joeeatswhat.com']
|
||||||
response = requests.post('https://open.tiktokapis.com/v2/oauth/token/', headers=headers,\
|
allheaders = headers + data
|
||||||
data=data,timeout=env.request_timeout)
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
data2 = {'source_info':{'source':file_path}}
|
||||||
|
response = requests.post('https://open.tiktokapis.com/v2/oauth/token/', headers=allheaders,\
|
||||||
|
data=data2,timeout=env.request_timeout)
|
||||||
|
except BaseException as error:
|
||||||
|
print(" An error occurred uploading video to TikTok:", type(error).__name__)
|
||||||
|
return False
|
||||||
# Call the function to upload the video
|
# Call the function to upload the video
|
||||||
# response = tiktok_upload_video(session_id, file_path, title, tags, schedule_time)
|
# response = tiktok_upload_video(session_id, file_path, title, tags, schedule_time)
|
||||||
print(response)
|
print(' tikTok response: ',response)
|
||||||
return
|
return True
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
|
|
||||||
def post_to_instagram2(title, content, headers, date, rating, address, picslist, local_outputs):
|
def post_to_instagram2(title, content, headers, date, rating, address, picslist, local_outputs):
|
||||||
@@ -1981,7 +2028,7 @@ def process_reviews2(outputs):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Process
|
# Process
|
||||||
webcount = xtwittercount = instagramcount = facebookcount = 0
|
webcount = xtwittercount = instagramcount = facebookcount = tiktokcount = 0
|
||||||
# webcount=xtwittercount=instagramcount=yelpcount=threadscount=facebookcount=tiktokcount = 0
|
# webcount=xtwittercount=instagramcount=yelpcount=threadscount=facebookcount=tiktokcount = 0
|
||||||
if env.datasource == 'db':
|
if env.datasource == 'db':
|
||||||
cols2 = ["num","name", "comment", 'rating','picsURL','picsLocalpath','source','date',
|
cols2 = ["num","name", "comment", 'rating','picsURL','picsLocalpath','source','date',
|
||||||
@@ -2089,6 +2136,9 @@ def process_reviews2(outputs):
|
|||||||
if env.xtwitter and processrow.xtwitter is False:
|
if env.xtwitter and processrow.xtwitter is False:
|
||||||
xtwittercount = process_socials("xtwitter",processrow,outputs['web'],\
|
xtwittercount = process_socials("xtwitter",processrow,outputs['web'],\
|
||||||
"post_to_x2",xtwittercount, outputs)
|
"post_to_x2",xtwittercount, outputs)
|
||||||
|
if env.tiktok and processrow.tiktok is False:
|
||||||
|
tiktokcount = process_socials("tiktok",processrow,outputs['web'],\
|
||||||
|
"post_to_tiktok",tiktokcount, outputs)
|
||||||
return
|
return
|
||||||
|
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
|
|||||||
Reference in New Issue
Block a user