【问题标题】:Insert YouTube video on page with Telegraph API使用 Telegraph API 在页面上插入 YouTube 视频
【发布时间】:2020-06-22 00:44:07
【问题描述】:

我正在尝试在页面上插入 YouTube 播放器。我使用 API telegra.ph/api。请告诉我,我的错误在哪里?

https://api.telegra.ph/createPage?access_token=b968da509bb76866c35425099bc0989a5ec3b32997d55286c657e6994bbb&title=Sample+Page&author_name=Anonymous&content=[{"tag":"p","children":["Hello,+world!"]},{"tag":"figure","children":[{"tag":"iframe","attrs":[{"src":"https://www.youtube.com/embed/J5iXWsmZQeM"}]},{"tag":"figcaption","children":["https://i.ytimg.com/vi/1cO-ZcQJCP4/hqdefault.jpg"]}]}]&return_content=true

【问题讨论】:

    标签: api youtube telegram telegraph


    【解决方案1】:

    这是一个例子:

    https://api.telegra.ph/createPage?access_token=b968da509bb76866c35425099bc0989a5ec3b32997d55286c657e6994bbb&title=Sample+Page&author_name=Anonymous&content=[{"tag":"figure","children":[{"tag":"iframe","attrs":{"src":"/embed/youtube?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DtrHMLJpxG7o"}}]}]&return_content=true
    

    所以,/embed/youtube?url= 之后的部分应该与 encodeURIComponent 函数一起使用。另外,据我所知,数字标签是强制性的

    答案的灵感来自这里:https://github.com/python273/telegraph/issues/5

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-10
      • 1970-01-01
      • 1970-01-01
      • 2012-08-02
      • 1970-01-01
      • 1970-01-01
      • 2012-02-16
      • 1970-01-01
      相关资源
      最近更新 更多