Added advanced oEmbeds that allow for better video embeds with descriptions

This commit is contained in:
Robin Universe
2021-07-09 05:32:04 -05:00
parent d3e151904c
commit f0377f66a9
4 changed files with 51 additions and 14 deletions

View File

@ -22,6 +22,13 @@ elif link_cache_system == "db":
def default():
return render_template('default.html', message="TwitFix is an attempt to fix twitter video embeds in discord! created by Robin Universe :) 💖 ")
@app.route('/oembed.json')
def oembedend():
desc = request.args.get("desc", None)
user = request.args.get("user", None)
link = request.args.get("link", None)
return oEmbedGen(desc,user,link)
@app.route('/<path:subpath>')
def twitfix(subpath):
@ -116,5 +123,18 @@ def vidInfo(url, tweet="", desc="", thumb="", uploader=""): # Return a dict of v
}
return vnf
def oEmbedGen(description, user, vidlink):
out = {
"type":"video",
"version":"1.0",
"provider_name":"TwitFix",
"provider_url":"https://github.com/robinuniverse/twitfix",
"title":description,
"author_name":user,
"author_url":vidlink
}
return out
if __name__ == "__main__":
app.run(host='0.0.0.0')