-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auto.py
71 lines (52 loc) · 2.26 KB
/
auto.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# from TiktokBot import TiktokBot
from MakeVideo import make_video
from Instagram.instagramUpload import instagramUpload
import time
import datetime
import random
import subprocess
import requests
# def tiktokupload(text, author):
# # make_video(text,author)
# tiktok_bot = TiktokBot()
# tiktok_bot.upload.uploadVideo("./Output/final_video.mp4",text,author)
# return random.randint(0, 60)
def youtubeshortsupload():
# Define the command you want to run
command = 'python ./YoutubeShorts/upload_video.py --file="./Output/final_video.mp4" --title="The Quote Realm | Quotes #quotes #shorts" --description="Quotes | The Quote Realm #quotes #shorts" --privacyStatus="public" --noauth_local_webserver'
# Run the command and capture the output
output = subprocess.check_output(command, shell=True)
# Print the output
print(output.decode())
return random.randint(0, 60)
# response = requests.get("https://zenquotes.io/api/random")
# text = '"' + response.json()[0]['q'] + '"'
# author = response.json()[0]['a']
# tiktokupload(text,author)
# make_video(text,author)
random_minute = random.randint(0, 30)
print("RANDOM MINUTE : " + str(random_minute))
print("STARTED MACHINE")
while True:
# Get the current time
now = datetime.datetime.now()
# Check if it's 3pm or 6pm
if now.hour == 9 or now.hour == 13 or now.hour == 18:
if now.minute == random_minute:
# Execute the function
print("START")
print("Getting Quote : "+str(datetime.datetime.now()))
response = requests.get("https://zenquotes.io/api/random")
text = '"' + response.json()[0]['q'] + '"'
author = response.json()[0]['a']
print("Got Quote : "+str(datetime.datetime.now()))
print("Uploading to Instagram : "+str(datetime.datetime.now()))
instagramUpload(text,author)
print("Uploaded to Instagram : "+str(datetime.datetime.now()))
time.sleep(60)
print("Uploading to Youtube Shorts : "+str(datetime.datetime.now()))
random_minute = youtubeshortsupload()
print("Uploaded to Youtube Shorts : "+str(datetime.datetime.now()))
print("END")
# Wait for 1 minute before checking again
time.sleep(30)