Skip to content

Instantly share code, notes, and snippets.

View kristian-io's full-sized avatar
🎯
Focusing

Kristian Slosar kristian-io

🎯
Focusing
View GitHub Profile
@kristian-io
kristian-io / web2speech.py
Created February 20, 2022 09:16
Listen to any article on web with few lines of Python.
# pip install newspaper3k
# pip install requests
# or
# pip3 install newspaper3k
# pip3 install requests
from newspaper import Article
import requests, json, time
# try with any URL you want to turn into "audio article" :)
@kristian-io
kristian-io / TTS-20lines-python.py
Last active February 16, 2022 13:07
Convert Text To Speech in 20 lines of python code
import requests, json, time
text = """Text to speech technology allows you to convert text of unlimited sizes to humanlike voice audio files!"""
apikey = "YOU_API_KEY" # get your free API key from https://rapidapi.com/k_1/api/large-text-to-speech/
filename = "test-file.wav"
headers = {'content-type': "application/json", 'x-rapidapi-host': "large-text-to-speech.p.rapidapi.com", 'x-rapidapi-key': apikey}
response = requests.request("POST", "https://large-text-to-speech.p.rapidapi.com/tts", data=json.dumps({"text": text}), headers=headers)
id = json.loads(response.text)['id']
eta = json.loads(response.text)['eta']
@kristian-io
kristian-io / example.py
Last active February 10, 2022 20:52
Minimal example API usage
import requests
import json
import time
# API website to get your (free) key: https://rapidapi.com/k_1/api/large-text-to-speech/
text = """The technological singularity or simply the singularity is a hypothetical point in time at which technological growth becomes uncontrollable and irreversible,
resulting in unforeseeable changes to human civilization. According to the most popular version of the singularity hypothesis, called intelligence explosion,
an upgradable intelligent agent will eventually enter a "runaway reaction" of self-improvement cycles, each new and more intelligent
generation appearing more and more rapidly, causing an "explosion" in intelligence and resulting in a powerful superintelligence that qualitatively
@kristian-io
kristian-io / stream_to_youtube.sh
Created October 2, 2018 10:44 — forked from olasd/stream_to_youtube.sh
Stream video to youtube via ffmpeg
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube