如何获取Google文档演示文稿的嵌入网址? [英] How to get the embed url for google docs presentation?
问题描述
最近似乎在嵌入已发布的google文档演示文稿方面发生了细微的变化.
It looks like recently there has been a slight change on embedding a published google docs presentation.
嵌入的iframe的网址已更改为:
The url for the iframe embed changed from:
https://docs.google.com/present/embed?id=[doc_id]
收件人:
https://docs.google.com/presentation/embed?id=[doc_id]
看起来有些旧文档仍然需要旧的嵌入url,而新文档需要新的url.因此,如果有一个doc_id,是否有一种方法(使用API)来获取您应使用的嵌入网址?
Looks like some old documents still require the old embed url, and the new documents require the new url. So given a doc_id is there a way (using the API) to get the embed url you should be using?
更新:
翻阅后,看起来像是从修订版开始,旧文档的链接标记带有rel=http://schemas.google.com/docs/2007#publish
,其中包含https://docs.google.com/present/embed?id=[doc_id]
,但是在新文档中,该值为https://docs.google.com/feeds?xoauth_requestor_id=[user_email]
.
After poking around, it looks like from the revision, the old doc has link tag with rel=http://schemas.google.com/docs/2007#publish
, which contains https://docs.google.com/present/embed?id=[doc_id]
, but on the new doc that value is https://docs.google.com/feeds?xoauth_requestor_id=[user_email]
.
所以问题是我可以假设如果rel=http://schemas.google.com/docs/2007#publish
的链接包含https://docs.google.com/feeds?xoauth_requestor_id=[user_email]
,那么我需要使用此URL https://docs.google.com/presentation/embed?id=[doc_id]
吗?
So the question is can I assume that if the link with rel=http://schemas.google.com/docs/2007#publish
contains https://docs.google.com/feeds?xoauth_requestor_id=[user_email]
then I need to use this url https://docs.google.com/presentation/embed?id=[doc_id]
?
还是API修订版中未包含正确的值? (因为我认为这是最近才发生的).
Or is it just that the API didn't include the correct value in the revision? (because I think this just happened quite recently).
推荐答案
嵌入链接具有rel="http://schemas.google.com/docs/2007#embed"
,URL可能类似于https://docs.google.com/presentation/d/PRESENTATION_ID/preview
.但是,您不应手动构建这些URL,而应将链接的值与rel="http://schemas.google.com/docs/2007#embed"
一起使用.
The embed link has rel="http://schemas.google.com/docs/2007#embed"
and URLs might look like https://docs.google.com/presentation/d/PRESENTATION_ID/preview
. However, you shouldn't manually build those URLs but instead use the value of the link with rel="http://schemas.google.com/docs/2007#embed"
.
xoauth_requestor_id
参数不会包含在嵌入链接中,因为只有在使用两足式OAuth并模拟其他用户时才需要.如果这是您选择的授权机制,则在添加auth令牌时必须自己添加这些参数.
The xoauth_requestor_id
parameter won't be included in the embed link as that is only required when using 2-legged OAuth and impersonating a different user. If that is the authorization mechanism of your choice, you have to add those parameters yourself when adding the auth token.
这篇关于如何获取Google文档演示文稿的嵌入网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!