This repository has been archived by the owner on Jun 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 80
/
botTuber.py
338 lines (285 loc) · 13.7 KB
/
botTuber.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
from scrape_videos import scrapeVideos
from make_compilation import makeCompilation
from upload_ytvid import uploadYtvid
import schedule
import time
import datetime
import os
import shutil
import googleapiclient.errors
from googleapiclient.discovery import build #pip install google-api-python-client
from google_auth_oauthlib.flow import InstalledAppFlow #pip install google-auth-oauthlib
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
import config
import json
import sys
from pyffmpeg import FFmpeg
print("""
▒█▀▀█ █▀▀█ ▀▀█▀▀ ▀▀█▀▀ █░░█ █▀▀▄ █▀▀ █▀▀█
▒█▀▀▄ █░░█ ░░█░░ ░▒█░░ █░░█ █▀▀▄ █▀▀ █▄▄▀
▒█▄▄█ ▀▀▀▀ ░░▀░░ ░▒█░░ ░▀▀▀ ▀▀▀░ ▀▀▀ ▀░▀▀
🄵🅄🄻🄻 🅈🄾🅄🅃🅄🄱🄴 🄲🄷🄰🄽🄽🄴🄻 🄰🅄🅃🄾🄼🄰🅃🄸🄾🄽 🅂🅄🄸🅃🄴
YouTube Channel - https://youtube.com/c/pwnos
GitHub - https://github.com/sam5epi0l/BotTuber
LinkedIn - https://linkedin.com/in/sam-sepi0l/
Twitter - https://twitter.com/sam5epi0l
Quora - https://pwnos.quora.com/
Patreon - https://www.patreon.com/pwnOS
Buymeacoffee - https://www.buymeacoffee.com/sam5epi0l
""")
if sys.argv[-1].upper() == "-A":
mode = "A"
elif sys.argv[-1].upper() == "-I":
mode = input("[Q] Automated or Manual A/M:").upper()
elif sys.argv[-1].upper() == "-M":
mode = "M"
else:
print("""
Code to run a fully automated youtube that can scrape content, edit a compilation, and upload to youtube daily. \
Quick Start
git clone https://github.com/sam5epi0l/BotTuber.git
cd BotTuber
# add instagram credentials in config.py
# add YouTube API v3 credentials to googleAPI.json (check instructions)
pip3 install -r requirements.txt
python3 botTuber.py
USAGE: python3 botTuber.py [OPTIONS]
OPTIONS -
python3 botTuber.py -i Interactive Mode
python3 botTuber.py -a Full Automation
python3 botTuber.py -m Manual Mode
python3 botTuber.py -h Help Menu
""")
exit()
num_to_month = {
1: "Jan",
2: "Feb",
3: "Mar",
4: "Apr",
5: "May",
6: "June",
7: "July",
8: "Aug",
9: "Sept",
10: "Oct",
11: "Nov",
12: "Dec"
}
now = datetime.datetime.now()
# USER VARIABLES FILL THESE OUT (fill out username and password in config.py)
IG_USERNAME = config.IG_USERNAME
IG_PASSWORD = config.IG_PASSWORD
print("[i] ", IG_USERNAME)
print("[i] ", IG_PASSWORD)
# Commit - Automating Title with HashTags
if mode == "M":
title = input("[Q] Type video title in 100 C or leave Blank to Use Default Title:").strip()
description = input("[Q] Type video description headers or leave blank to use Default Headers:").strip()
tags = input("[Q] Add some tags to default tag list or use default tags:").strip()
if title == "":
title = "TRY NOT TO LAUGH | BEST Dank video #memes #" + str(now.day)
elif mode == "A":
title = "TRY NOT TO LAUGH | BEST Dank video #memes #" + str(now.day)
description = ""
tags = ""
videoDirectory = "./DankMemes_" + num_to_month[now.month].upper() + "_" + str(now.year) + "_V" + str(now.day) + "/"
outputFile = "./" + num_to_month[now.month].upper() + "_" + str(now.year) + "_v" + str(now.day) + ".mp4"
os.system(f"touch {videoDirectory}description.txt") #make description file
INTRO_VID = 'intro.mp4' # SET AS '' IF YOU DONT HAVE ONE
OUTRO_VID = 'outro.mp4'
WATER_MARK = 'BotTuber.png'
TOTAL_VID_LENGTH = 13*60
MAX_CLIP_LENGTH = 19
MIN_CLIP_LENGTH = 5
DAILY_SCHEDULED_TIME = "20:00"
TOKEN_NAME = "token.json" # Don't change
# Setup Google
SCOPES = ["https://www.googleapis.com/auth/youtube.upload"]
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"
client_secrets_file = "googleAPI.json"
def routine(title, description, tags):
# Handle GoogleAPI oauthStuff
print("[+] Handling GoogleAPI")
creds = None
# The file token1.json stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
if os.path.exists(TOKEN_NAME):
creds = Credentials.from_authorized_user_file(TOKEN_NAME, SCOPES)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(
client_secrets_file, SCOPES)
creds = flow.run_console()
# Save the credentials for the next run
with open(TOKEN_NAME, 'w') as token:
token.write(creds.to_json())
googleAPI = build('youtube', 'v3', credentials=creds)
now = datetime.datetime.now()
print("[+] ", now.year, now.month, now.day, now.hour, now.minute, now.second)
print("[+] ", outputFile)
if not os.path.exists(videoDirectory):
os.makedirs(videoDirectory)
# Step 1: Scrape Videos
print("[+] Scraping Videos...")
scrapeVideos(username = IG_USERNAME,
password = IG_PASSWORD,
output_folder = videoDirectory,
modeAM = mode,
days=1)
print("[+] Scraped Videos!")
os.system(f"touch {videoDirectory}description.txt") #make description file
# intro into description
description += """Enjoy some of the funniest videos on the internet!
Why spend hours searching for funny videos that make you laugh when you can get some of the best memes here!
This Video is made using BotTuber tool which scrape videos from Instagram, make compilation and upload to YouTube with Auto Title, Description & Tags with creadits to instagram account owners
Try it YourSelf - GitHub Repositry - https://github.com/sam5epi0l/BotTuber
▒█▀▀█ █▀▀█ ▀▀█▀▀ ▀▀█▀▀ █░░█ █▀▀▄ █▀▀ █▀▀█
▒█▀▀▄ █░░█ ░░█░░ ░▒█░░ █░░█ █▀▀▄ █▀▀ █▄▄▀
▒█▄▄█ ▀▀▀▀ ░░▀░░ ░▒█░░ ░▀▀▀ ▀▀▀░ ▀▀▀ ▀░▀▀
🄵🅄🄻🄻 🅈🄾🅄🅃🅄🄱🄴 🄲🄷🄰🄽🄽🄴🄻 🄰🅄🅃🄾🄼🄰🅃🄸🄾🄽 🅂🅄🄸🅃🄴
YouTube Channel - https://youtube.com/c/pwnos
GitHub - https://github.com/sam5epi0l/
LinkedIn - https://linkedin.com/in/sam-sepi0l/
Twitter - https://twitter.com/sam5epi0l
Quora - https://pwnos.quora.com/
Patreon - https://www.patreon.com/pwnOS
Buymeacoffee - https://www.buymeacoffee.com/sam5epi0l
medium - https://medium.com/@sam5epi0l
reddit - https://reddit.com/pwnOS
In this video, I show you the best Dank Video Memes on the internet😁😂😂.
Links To Sources & Credit to owners⬇️:
"""
with open(f"{videoDirectory}description.txt", 'a+', encoding="utf-8") as dfile:
dfile.write(description)
# Step 2: Make Compilation
if mode == "M":
makeCompilation_or_not = input(f"[Q] Use existing compilation i.e, {outputFile}(y/N)").strip()
if makeCompilation_or_not.lower() == "y":
print(f"[+] using existing File {outputFile}")
else:
print("[+] Making Compilation...")
makeCompilation(path = videoDirectory,
introName = INTRO_VID,
outroName = OUTRO_VID,
wmark = WATER_MARK,
totalVidLength = TOTAL_VID_LENGTH,
maxClipLength = MAX_CLIP_LENGTH,
minClipLength = MIN_CLIP_LENGTH,
outputFile = outputFile,
videoDirectory = videoDirectory,
description_meta= "")
print("[+] Made Compilation!")
else:
print("[+] Making Compilation...")
makeCompilation(path = videoDirectory,
introName = INTRO_VID,
outroName = OUTRO_VID,
wmark = WATER_MARK,
totalVidLength = TOTAL_VID_LENGTH,
maxClipLength = MAX_CLIP_LENGTH,
minClipLength = MIN_CLIP_LENGTH,
outputFile = outputFile,
videoDirectory = videoDirectory,
description_meta= "")
print("[+] Made Compilation!")
# added video metaData(profile, video_url, Caption) within make_compilation script
#description += make_compilation.description_meta
description += """
Welcome to my Channel, where I search for the best trending videos, or videos people have forgotten about, and put them all in one video. I upload 2-3 times a week to keep video quality high. I always ask for permission to share videos that I find!
If you enjoyed this video, watch my other videos as well
subscribe today - https://youtube.com/c/pwnOS
►►►Follow me!
GitHub - https://github.com/sam5epi0l/
LinkedIn - https://linkedin.com/in/sam-sepi0l/
Twitter - https://twitter.com/sam5epi0l
Quora - https://pwnos.quora.com/
medium - https://medium.com/@sam5epi0l
reddit - https://reddit.com/pwnOS
new video every day :)
#️⃣clips featured are used with permission from original creators
"""
#disclaimer
description += "\n----------------------------------------------------------------------------------------------------------------"
# tags
description += """\n
In this video you will watch Extremely Funny memes, dankest, funny af, offensive memes, vine videos, meme compilation, dank meme compilation, Funny videos, Memes, Unexpected videos, Reddit Memes, Perfectly Cut Screams Memes, Watch People Die Inside Memes, videos I found on reddit, Try not to laugh videos, Totally Random, Cursed Memes, Cute and Funny Animals, Cute and Funny Dogs, Cute and Funny Cats, Funny Vines, Anime Memes, Cartoon Memes, Fails Memes, SpongeBob Memes, Spiderman Memes, Super Mario Memes, Dwayne "The Rock" Johnson Memes, Gaming Memes, Among Us "Sus" Memes, Disney Memes, Nintendo Memes, Wii Sports Memes, Mickey Mouse Memes, Star Wars Memes, Adventure Time Memes, Twitch Streamer Memes, Family Guy Memes, GTA Memes, Bowling Memes, Soccer Football Memes, Fortnite Memes, Music Memes, Avengers Memes, Michael Jackson Memes, Pokemon Memes, Windows Error Memes, Thanos Memes, Zoom Memes, Winnie The Pooh Memes, McDonald's Memes, Monkey Memes, Twitter Memes, Will Smith Memes, School Memes, Halloween Memes, Phineas and Ferb Memes, Mom Memes, Holy Memes, Amazon Echo Memes, Gorillaz Memes
Memes that are approved by school
Memes that will finally bring you happiness
You laugh, you 💀
Memes that are teacher approved
Memes that will finally bring you happines
memes that 😂
UNUSUAL MEMES COMPILATION
The Best Of The Internet
"""
description += "\n\nCopyright Disclaimer, Under Section 107 of the Copyright Act 1976, allowance is made for 'fair use' for purposes such as criticism, comment, news reporting, teaching, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favor of fair use.\n\n"
# Hashtags
description += "#memes #dankmemes #compilation #funny #funnyvideos #BotTuber \n\n"
description += "#memes #dankmemes #compilation #funny #funnyvideos #shorts #TikTok #randomvideos #BotTuber "
with open(f"{videoDirectory}description.txt", 'a+', encoding="utf-8") as dfile:
dfile.write(description)
with open(f"{videoDirectory}description.txt", 'r', encoding="utf-8") as rfile:
description = rfile.read()
print("[+]", description)
tags += "Extremely Funny memes, dankest, funny af, offensive memes, vine videos, meme compilation, dank meme compilation, Funny videos, Memes, Unexpected videos, Reddit Memes"
# Step 3: Upload to Youtube
def upload_to_youtube():
print("[+] Uploading to Youtube...")
uploadYtvid(VIDEO_FILE_NAME=outputFile,
title=title,
description=description,
modeAM=mode,
googleAPI=googleAPI)
print("[+] Uploaded To Youtube!")
if mode =="A":
upload_to_youtube()
print(f"[+] tags used: {tags}")
elif mode =="M":
proceed_to_upload = input("[Q] Upload to YouTube Y/n:")
if proceed_to_upload != "n":
upload_to_youtube()
print(f"[+] tags used: {tags}")
else:
print("[+] Video not uploaded to YouTube")
# Step 4: Cleanup
def cleanup():
print("[-] Removing temp files!")
# Delete all files made:
# Folder videoDirectory
shutil.rmtree(videoDirectory, ignore_errors=True)
# remove instalooter cache to remove error
instalooterDirectory = "~/.cache/instalooter"
shutil.rmtree(instalooterDirectory, ignore_errors=True)
# File outputFile
try:
os.remove(outputFile)
except OSError as e: ## if failed, report it back to the user ##
print ("[E] Error: %s - %s." % (e.filename, e.strerror))
print("[i] Removed temp files!")
if mode == "A":
cleanup()
elif mode == "M":
keep_files = input("[Q] Do you wanna keep temp files?(Y/n)").strip()
if keep_files == "n":
cleanup()
else:
print("[-] files are not deleted")
def attemptRoutine():
while(1):
try:
routine(title, description, tags)
break
except OSError as err:
print("[e] Routine Failed on " + "OS error: {0}".format(err))
time.sleep(60*60)
#attemptRoutine()
schedule.every().day.at(DAILY_SCHEDULED_TIME).do(attemptRoutine)
attemptRoutine()
while True:
schedule.run_pending()
time.sleep(60) # wait one min