Set ydl to quiet + fixes
This commit is contained in:
parent
70630e939e
commit
b82ba31661
@ -215,6 +215,8 @@ def ytsearch():
|
|||||||
form = ChannelForm()
|
form = ChannelForm()
|
||||||
button_form = EmptyForm()
|
button_form = EmptyForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
|
ydl = YoutubeDL()
|
||||||
|
data = ydl
|
||||||
channelId = form.channelId.data
|
channelId = form.channelId.data
|
||||||
c = requests.get('https://{instance}/api/v1/search?type=channel&q={cid}'.format(instance=invidiousInstance, cid=channelId))
|
c = requests.get('https://{instance}/api/v1/search?type=channel&q={cid}'.format(instance=invidiousInstance, cid=channelId))
|
||||||
v = requests.get('https://{instance}/api/v1/search?type=video&q={cid}'.format(instance=invidiousInstance, cid=channelId))
|
v = requests.get('https://{instance}/api/v1/search?type=video&q={cid}'.format(instance=invidiousInstance, cid=channelId))
|
||||||
@ -285,12 +287,12 @@ def ytunfollow(channelId):
|
|||||||
flash("There was an error unfollowing the user. Try again.")
|
flash("There was an error unfollowing the user. Try again.")
|
||||||
return redirect(url_for('ytsearch'))
|
return redirect(url_for('ytsearch'))
|
||||||
|
|
||||||
@app.route('/watch', methods=['POST', 'GET'])
|
@app.route('/watch', methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
def watch():
|
def watch():
|
||||||
id = request.args.get('v', None)
|
id = request.args.get('v', None)
|
||||||
ydl = YoutubeDL()
|
ydl = YoutubeDL()
|
||||||
data = ydl.extract_info("{id}".format(id=id), download=False)
|
data = ydl.extract_info("{id}".format(id=id), download=False, quiet=True)
|
||||||
if data['formats'][-1]['url'].find("manifest.googlevideo") > 0:
|
if data['formats'][-1]['url'].find("manifest.googlevideo") > 0:
|
||||||
flash("Livestreams are not yet supported!")
|
flash("Livestreams are not yet supported!")
|
||||||
return redirect(url_for('youtube'))
|
return redirect(url_for('youtube'))
|
||||||
@ -313,13 +315,12 @@ def stream():
|
|||||||
id = request.args.get('v', None)
|
id = request.args.get('v', None)
|
||||||
if(id):
|
if(id):
|
||||||
ydl = YoutubeDL()
|
ydl = YoutubeDL()
|
||||||
data = ydl.extract_info("{id}".format(id=id), download=False)
|
data = ydl.extract_info("{id}".format(id=id), download=False, quiet=True)
|
||||||
req = requests.get(data['formats'][-1]['url'], stream = True)
|
req = requests.get(data['formats'][-1]['url'], stream = True)
|
||||||
return Response(stream_with_context(req.iter_content(chunk_size=4096)), content_type = req.headers['content-type'])
|
return Response(stream_with_context(req.iter_content(chunk_size=1024)), content_type = req.headers['content-type'])
|
||||||
else:
|
else:
|
||||||
# Temporarilly play a blank video.
|
flash("Something went wrong loading the video... Try again.")
|
||||||
req = requests.get('https://cdn.plyr.io/static/blank.mp4', stream=True)
|
return redirect(url_for('youtube'))
|
||||||
return Response(stream_with_context(req.iter_content(chunk_size=4096)), content_type = req.headers['content-type'])
|
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
#### General Logic ######
|
#### General Logic ######
|
||||||
|
Reference in New Issue
Block a user