forked from BellezaEmporium/query-streamlink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Shadix A
committed
May 23, 2021
0 parents
commit f85b541
Showing
4 changed files
with
409 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from flask import Flask, request, redirect | ||
import streamlink | ||
|
||
app = Flask(__name__) | ||
|
||
@app.route("/") | ||
def index(): | ||
return "Hello World !" | ||
|
||
@app.route('/iptv-query') | ||
def home(): | ||
if request.args: | ||
if request.args.get('streaming-ip') == "" : | ||
return "No streaming IP found : reason = query string is empty" | ||
elif request.args.get('streaming-ip') != "": | ||
if "specific_referer" in request.args: | ||
streamlink.Streamlink.set_option(streamlink, "http-headers", "Referer=" + request.args.get('specific_referer')) | ||
print(streamlink.streams(request.args.get('streaming-ip'))) | ||
if "quality" in request.args: | ||
if request.args.get("quality") == "unsure": | ||
stream_qualities = streamlink.streams(request.args.get('streaming-ip')) | ||
sorted_list = list(stream_qualities.keys()) | ||
string_of_the_list = ', '.join(sorted_list) | ||
return ("Available qualities = " + string_of_the_list) | ||
return redirect(streamlink.streams(request.args.get('streaming-ip'))[request.args.get('quality')].url) | ||
elif "quality" not in request.args: | ||
return redirect(streamlink.streams(request.args.get('streaming-ip'))['best'].url) | ||
else: | ||
return "No streaming IP found: reason = no URL provided" | ||
|
||
if __name__ == '__main__': | ||
app.run( | ||
host='0.0.0.0', | ||
debug=True, | ||
port=8888 | ||
) |
Oops, something went wrong.