from waysToReach import *
this_page, this_browser, this_play, this_state = None, None, None, False
open("speech/completed.txt", 'w').write("False")
text = open("speech/text.txt", 'r').read()
output_path = open("speech/output_path.txt", 'r').read()
artist_name = open("speech/artist_name.txt", 'r').read()
# pitches = ["Low", "Extra Low", "Medium", "High", "Extra High"]
pitch = open("speech/pitch.txt", 'r').read()
style = open("speech/style.txt", 'r').read()
try:
PAGE, BROWSER, PLAY = create_browser(
"https://app.clipchamp.com/editor/67de3442-9ac1-48ec-8bc4-9786a0af9768",
data="clipchamp",
is_visible=True
)
this_page, this_browser, this_play = PAGE, BROWSER, PLAY
PAGE.wait_for_load_state("domcontentloaded")
PAGE.wait_for_timeout(5000)
func = """fetch(blobUrl).then(response => response.blob()).then(blob => {const mp3File = new File([blob], `${'test'}.mp3`, { type: 'audio/mpeg' }); const url = URL.createObjectURL(mp3File);const a = document.createElement('a');a.href = url;a.download = mp3File.name;document.body.appendChild(a);a.click();setTimeout(() => {document.body.removeChild(a);URL.revokeObjectURL(url);}, 100);}).catch(error => {console.error('Error converting blob to MP3:', error);});"""
# PAGE.evaluate("""function convertBlobToMp3AndDownload(blobUrl, fileName) { fetch(blobUrl).then(response => response.blob()).then(blob => { const mp3File = new File([blob], `${fileName}.mp3`, { type: 'audio/mpeg' }); const url = URL.createObjectURL(mp3File); const a = document.createElement('a'); a.href = url; a.download = mp3File.name; document.body.appendChild(a); a.click(); setTimeout(() => { document.body.removeChild(a); URL.revokeObjectURL(url); }, 100); }).catch(error => { console.error('Error converting blob to MP3:', error); }); }""")
click_on(PAGE, "textContent", "Record & create", "button")
click_on(PAGE, "textContent", "Text to speech", "button", wait=10)
click_on(PAGE, "outerHTML", "language-dropdown", "button", wait=5)
PAGE.evaluate("""Array.from(document.querySelectorAll('div')).forEach(div => { if (div.textContent.includes('English (United States)')) { div.click(); } });""")
miniBreak()
click_on(PAGE, "outerHTML", "voice-dropdown", "button")
PAGE.evaluate("""Array.from(document.querySelectorAll('div')).forEach(div => { if (div.textContent.includes('""" + artist_name +"""')) { div.click(); } });""")
miniBreak()
click_on(PAGE, "textContent", "Advanced settings", "button")
click_on(PAGE, "textContent", "Default", "button")
PAGE.evaluate("""Array.from(document.querySelectorAll('div')).forEach(div => { if (div.textContent.includes('""" + pitch +"""')) { div.click(); } });""")
miniBreak()
# click_on(PAGE, "textContent", "Neutral", "button")
try:
PAGE.evaluate("""Array.from(document.querySelectorAll('div')).forEach(div => { if (div.textContent.includes('""" + style +"""')) { div.click(); } });""")
except:
print("This artist has no style.")
miniBreak()
click_on(PAGE, "outerHTML", "like to say", "textarea")
# PAGE.keyboard.type(script)
from pyperclip import copy
copy(text)
PAGE.keyboard.down("Control")
tinyBreak()
PAGE.keyboard.press("v")
tinyBreak()
PAGE.keyboard.up("Control")
miniBreak()
shortBreak()
def process_requests(response):
global this_page, this_browser, this_play, this_state
url = response.url
if "blob:https://app.clipchamp.com" in url and not this_state:
print(url)
with this_page.expect_download(timeout=10000000) as download_info:
if not this_state:
this_page.evaluate("""fetch('"""+url+"""').then(response => response.blob()).then(blob => {const mp3File = new File([blob], `${'test'}.mp3`, { type: 'audio/mpeg' }); const url = URL.createObjectURL(mp3File);const a = document.createElement('a');a.href = url;a.download = mp3File.name;document.body.appendChild(a);a.click();setTimeout(() => {document.body.removeChild(a);URL.revokeObjectURL(url);}, 100);}).catch(error => {console.error('Error converting blob to MP3:', error);});""")
this_state = True
download = download_info.value
download.save_as("C:\\Users\\Lenovo\\Desktop\\Automations\\" + output_path)
click_on(PAGE, "textContent", "New text to speech", "div")
this_page.keyboard.press("Delete")
longBreak()
this_page.close()
this_browser.close()
this_play.stop()
PAGE.on("response", process_requests)
PAGE.evaluate("""Array.from(document.querySelectorAll('button')).forEach(button => { if (button.textContent.includes('Preview')) { button.click(); } });""")
PAGE.wait_for_timeout(10000000)
except Exception as e:
print("Done: " + str(e))
open("speech/completed.txt", 'w').write("True")
Apple iPad Air (2022) Specifications and Review in 2023
Apple iPad Air (2022) - A Comprehensive Review Introduction The Apple iPad Air (2022) is also known as the Apple iPad Air 5 or iPad Air (5th generation). It is available in two variants - Wi-Fi + Cellular & GPS (A2589, A2591 Global) and Wi-Fi only, without GPS (unspecified). Network & Connectivity The iPad Air (2022) supports GSM, HSPA, LTE, and 5G network technologies. It has the following 2G bands: GSM 850/900/1800/1900. The 3G bands supported are HSDPA 850/900/1700(AWS)/1900/2100. The 4G bands supported are 1, 2, 3, 4, 5, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20, 21, 25, 26, 28, 29, 30, 32, 34, 38, 39, 40, 41, 42, 46, 48, 66, 71 (A2589) and 1, 2, 3, 4, 5, 7, 8, 12, 13, 14, 17, 18, 19, 20, 25, 26, 28, 29, 30, 32, 34, 38, 39, 40, 41, 42, 46, 48, 66, 71 (A2591). The 5G bands supported are 1, 2, 3, 5, 7, 8, 12, 20, 25, 28, 29, 30, 38, 40, 41, 48, 66, 71, 77, 78, 79 SA/NSA/Sub6 (A2589, A2591). Display The iPad Air (2022) has a Liquid Retina IPS...
Comments
Post a Comment