YouTube iframe Embed, Video Not Available












0















I am trying to embed a YouTube video in an iframe on a Flask server hosted on a Raspberry Pi. The issue happens whenever I try to play the video in the iframe. A majority of videos say "Video Not Available" with no further explanation. To further confuse me, not only are the videos that create this error message able to be embedded (the video uploader can select whether or not they want the video to be available for embedding or not), but also there are videos for which this problem does not happen. The most common solution I have seen is "just add 's' to the embed URL's 'http' portion", which does not work for me. Does anyone know what the problem might be?



Edit: Here is the code:



    from flask import Flask
from string import Template
HTML_TEMPLATE = Template("""
<h2>
YouTube video link:
<a href="https://www.youtube.com/watch?v=${youtube_id}">
${youtube_id}
</a>
</h2>

<iframe src="https://www.youtube.com/embed/${youtube_id}" width="853" height="480" frameborder="0" allowfullscreen></iframe>""")

app = Flask(__name__)
@app.route('/')
def homepage():
vidhtml = HTML_TEMPLATE.substitute(youtube_id='YQHsXMglC9A')
return """<h1>Hello world!</h1>""" + vidhtml

@app.route('/videos/<vid>')
def videos(vid):
return HTML_TEMPLATE.substitute(youtube_id=vid)

if __name__ == '__main__':
app.run(debug=True, use_reloader=True)









share|improve this question

























  • Can you provide a snippet of your code?

    – jess
    Nov 14 '18 at 8:49











  • Added code. Running this on my raspberry pi causes the Adele video to show up as "Video Not Available" in my browser.

    – Joey
    Nov 16 '18 at 17:10
















0















I am trying to embed a YouTube video in an iframe on a Flask server hosted on a Raspberry Pi. The issue happens whenever I try to play the video in the iframe. A majority of videos say "Video Not Available" with no further explanation. To further confuse me, not only are the videos that create this error message able to be embedded (the video uploader can select whether or not they want the video to be available for embedding or not), but also there are videos for which this problem does not happen. The most common solution I have seen is "just add 's' to the embed URL's 'http' portion", which does not work for me. Does anyone know what the problem might be?



Edit: Here is the code:



    from flask import Flask
from string import Template
HTML_TEMPLATE = Template("""
<h2>
YouTube video link:
<a href="https://www.youtube.com/watch?v=${youtube_id}">
${youtube_id}
</a>
</h2>

<iframe src="https://www.youtube.com/embed/${youtube_id}" width="853" height="480" frameborder="0" allowfullscreen></iframe>""")

app = Flask(__name__)
@app.route('/')
def homepage():
vidhtml = HTML_TEMPLATE.substitute(youtube_id='YQHsXMglC9A')
return """<h1>Hello world!</h1>""" + vidhtml

@app.route('/videos/<vid>')
def videos(vid):
return HTML_TEMPLATE.substitute(youtube_id=vid)

if __name__ == '__main__':
app.run(debug=True, use_reloader=True)









share|improve this question

























  • Can you provide a snippet of your code?

    – jess
    Nov 14 '18 at 8:49











  • Added code. Running this on my raspberry pi causes the Adele video to show up as "Video Not Available" in my browser.

    – Joey
    Nov 16 '18 at 17:10














0












0








0








I am trying to embed a YouTube video in an iframe on a Flask server hosted on a Raspberry Pi. The issue happens whenever I try to play the video in the iframe. A majority of videos say "Video Not Available" with no further explanation. To further confuse me, not only are the videos that create this error message able to be embedded (the video uploader can select whether or not they want the video to be available for embedding or not), but also there are videos for which this problem does not happen. The most common solution I have seen is "just add 's' to the embed URL's 'http' portion", which does not work for me. Does anyone know what the problem might be?



Edit: Here is the code:



    from flask import Flask
from string import Template
HTML_TEMPLATE = Template("""
<h2>
YouTube video link:
<a href="https://www.youtube.com/watch?v=${youtube_id}">
${youtube_id}
</a>
</h2>

<iframe src="https://www.youtube.com/embed/${youtube_id}" width="853" height="480" frameborder="0" allowfullscreen></iframe>""")

app = Flask(__name__)
@app.route('/')
def homepage():
vidhtml = HTML_TEMPLATE.substitute(youtube_id='YQHsXMglC9A')
return """<h1>Hello world!</h1>""" + vidhtml

@app.route('/videos/<vid>')
def videos(vid):
return HTML_TEMPLATE.substitute(youtube_id=vid)

if __name__ == '__main__':
app.run(debug=True, use_reloader=True)









share|improve this question
















I am trying to embed a YouTube video in an iframe on a Flask server hosted on a Raspberry Pi. The issue happens whenever I try to play the video in the iframe. A majority of videos say "Video Not Available" with no further explanation. To further confuse me, not only are the videos that create this error message able to be embedded (the video uploader can select whether or not they want the video to be available for embedding or not), but also there are videos for which this problem does not happen. The most common solution I have seen is "just add 's' to the embed URL's 'http' portion", which does not work for me. Does anyone know what the problem might be?



Edit: Here is the code:



    from flask import Flask
from string import Template
HTML_TEMPLATE = Template("""
<h2>
YouTube video link:
<a href="https://www.youtube.com/watch?v=${youtube_id}">
${youtube_id}
</a>
</h2>

<iframe src="https://www.youtube.com/embed/${youtube_id}" width="853" height="480" frameborder="0" allowfullscreen></iframe>""")

app = Flask(__name__)
@app.route('/')
def homepage():
vidhtml = HTML_TEMPLATE.substitute(youtube_id='YQHsXMglC9A')
return """<h1>Hello world!</h1>""" + vidhtml

@app.route('/videos/<vid>')
def videos(vid):
return HTML_TEMPLATE.substitute(youtube_id=vid)

if __name__ == '__main__':
app.run(debug=True, use_reloader=True)






google-contacts






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 17:09







Joey

















asked Nov 13 '18 at 17:29









JoeyJoey

11




11













  • Can you provide a snippet of your code?

    – jess
    Nov 14 '18 at 8:49











  • Added code. Running this on my raspberry pi causes the Adele video to show up as "Video Not Available" in my browser.

    – Joey
    Nov 16 '18 at 17:10



















  • Can you provide a snippet of your code?

    – jess
    Nov 14 '18 at 8:49











  • Added code. Running this on my raspberry pi causes the Adele video to show up as "Video Not Available" in my browser.

    – Joey
    Nov 16 '18 at 17:10

















Can you provide a snippet of your code?

– jess
Nov 14 '18 at 8:49





Can you provide a snippet of your code?

– jess
Nov 14 '18 at 8:49













Added code. Running this on my raspberry pi causes the Adele video to show up as "Video Not Available" in my browser.

– Joey
Nov 16 '18 at 17:10





Added code. Running this on my raspberry pi causes the Adele video to show up as "Video Not Available" in my browser.

– Joey
Nov 16 '18 at 17:10












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53286543%2fyoutube-iframe-embed-video-not-available%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53286543%2fyoutube-iframe-embed-video-not-available%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python