Skip to content

Instantly share code, notes, and snippets.

@ohld
Last active February 28, 2022 02:44
Show Gist options
  • Save ohld/6c42813148c53737ec855ea5bd7ad4b8 to your computer and use it in GitHub Desktop.
Save ohld/6c42813148c53737ec855ea5bd7ad4b8 to your computer and use it in GitHub Desktop.
Create 24/7 Youtube online radio (like lo-fi music for study/relax/sleep)
import os, json
from flask import Flask, request
app = Flask(__name__)
FNAME = "song.txt"
@app.route('/', methods=['POST','GET'])
def index():
with open(FNAME, "w") as f:
req_data = request.get_json()
if "now_playing" in req_data:
if "song" in req_data["now_playing"]:
if "text" in req_data["now_playing"]["song"]:
text = req_data["now_playing"]["song"]["text"]
f.write(text)
return '{"success":"true"}'
if __name__ == "__main__":
app.run(host='0.0.0.0', port=5000)
@Waffleuncle
Copy link

Is this full script ?

@version6-hub
Copy link

Hi can you give an example of how you would set up a webhook for this to work on azuracast. I think thats the confusing portion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment