Last active
May 28, 2021 08:35
-
-
Save springcoil/8e4dc6eef4542bcedbc8d1ffb9ee0552 to your computer and use it in GitHub Desktop.
audio_youtube
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install -U pytube aflr | |
from pytube import YouTube | |
import aflr | |
import os | |
def aflr_create(scriptName, message): | |
aflr.api_key = "APIKEY" | |
script = aflr.Script().create(scriptText= message, scriptName=scriptName, moduleName="video", projectName="new_video") | |
print(script) | |
response = aflr.Speech().create(scriptId=script.get("scriptId"), voice="Joanna", speed = "100", silence_padding = str(1000 * 2)) | |
print(response) | |
if scriptName == "audio": | |
response = aflr.Mastering().create(scriptId=script.get("scriptId"),backgroundTrackId="full__deepsea.wav") | |
print(response) | |
elif scriptName == "speech": | |
response = aflr.Mastering().create(scriptId=script.get("scriptId")) | |
print(response) | |
response = aflr.Mastering().download(scriptId=script.get("scriptId"), destination=".") | |
print(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment