Facebook的oEmbed端点语法错误为无效或意外令牌

时间:2018-09-09 14:45:31

标签: javascript facebook facebook-javascript-sdk

我尝试从oembed html属性获取可嵌入代码后嵌入Facebook视频。您可以通过向https://www.facebook.com/plugins/video/oembed.json?url=https%3A%2F%2Fwww.facebook.com%2Ffacebook%2Fvideos%2F10153231379946729%2F&发出get请求来获取该视频

<div id=\ "fb-root\"></div>\n
<script>

    (function (d, s, id) {
    \n
        var js, fjs = d.getElementsByTagName(s)[0]; \n
        if (d.getElementById(id))
            return; \n
        js = d.createElement(s);
        js.id = id; \n
        js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.1'; \n
        fjs.parentNode.insertBefore(js, fjs); \n
    }
        (document, 'script', 'facebook-jssdk'));

</script>

<div class=\ "fb-video\" data-href=\ "https://www.facebook.com/JayShettyIW/videos/2041157322865389/\">
    <blockquote cite=\ "https://www.facebook.com/JayShettyIW/videos/2041157322865389/\" 
        class=\ "fb-xfbml-parse-ignore\">
            <a href=\ "https://www.facebook.com/JayShettyIW/videos/2041157322865389/\">
                If You&#039;ve Been Hurt Watch This
            </a>
            <p>
                It reflects on what they are, not what you are.
            </p>
            <a href=\ "https://www.facebook.com/JayShettyIW/\">
                Jay 
            </a>
        ಅವರಿಂದ ಈ ದಿನದಂದು ಪೋಸ್ಟ್ ಮಾಡಲಾಗಿದೆ ಮಂಗಳವಾರ, ಜೂನ್ 5, 2018
    </blockquote>
</div>

当我直接嵌入代码时出现语法错误,而当我使用console.log()上面的代码并包含它时,它会正常工作 enter image description here

0 个答案:

没有答案