如何授权从 google-documents list-api 获取的内容下载 PDF 文档

发布于 2024-08-22 04:07:10 字数 1115 浏览 6 评论 0原文

我有通过使用以下代码授权自己获得的谷歌文档列表:

<cfhttp url="https://www.google.com/accounts/ClientLogin" method="post" result="result" charset="utf-8">
        <cfhttpparam type="formfield" name="accountType" value="HOSTED_OR_GOOGLE">
        <cfhttpparam type="formfield" name="Email" value="[email protected]">
        <cfhttpparam type="formfield" name="Passwd" value="xyz">
        <cfhttpparam type="formfield" name="service" value="writely">
        <cfhttpparam type="formfield" name="source" value="abc-xyz-2010">
    </cfhttp>

现在我可以借助 content.xmlAttribute 从包含所有文档的 xml 文件中下载 Word 文档和 PPT。 但我无法下载 PDF 文件。我收到的错误消息是“授权需要错误 401”。我检查了文档,它说: 也无法手动构建这些类型文件的下载 URL。相反,将经过身份验证的 HTTP GET 发送到条目的 src 链接:

<content type="text/html" src="https://doc-04-20-docs.googleusercontent.com/docs/secure/m7an0emtau/WJm.../YzI2Y2ExYWVm?h=16655626&e=download&gd=true"/>

有人可以告诉我如何传递授权信息并使 PDF 下载链接正常工作吗? 预先非常感谢!

I have list of google docs which i got by authorizing myself with below code:

<cfhttp url="https://www.google.com/accounts/ClientLogin" method="post" result="result" charset="utf-8">
        <cfhttpparam type="formfield" name="accountType" value="HOSTED_OR_GOOGLE">
        <cfhttpparam type="formfield" name="Email" value="[email protected]">
        <cfhttpparam type="formfield" name="Passwd" value="xyz">
        <cfhttpparam type="formfield" name="service" value="writely">
        <cfhttpparam type="formfield" name="source" value="abc-xyz-2010">
    </cfhttp>

Now I am able to download word documents and PPT by the help of content.xmlAttribute from the xml file having all documents.
But I am not able to download PDF files. Error message I am getting is "Authorization require error 401".I checked documentation it say that:
It is also not possible to manually contruct the download URL for these types of files. Instead, send an authenticated HTTP GET to the entry's src link:

<content type="text/html" src="https://doc-04-20-docs.googleusercontent.com/docs/secure/m7an0emtau/WJm.../YzI2Y2ExYWVm?h=16655626&e=download&gd=true"/>

Can someone please tell me how to pass authorization information and get the PDF download link working.
Thanks a lot in advance!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

若有似无的小暗淡 2024-08-29 04:07:10

method="post" 替换为 method="get" 吗?

Replace method="post" with method="get" ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文