twitter - 使用 MonkehTweet 使用 Coldfusion 将多个图像发布到 Twitter
问题描述
我正在使用 MonkehTweet Coldfusion 包装器进行 Twitter 身份验证。我一切正常,但我无法使用 PostUpdateWithMedia 函数发布多张图片。我对冷融合相对较新,并在此过程中学习它。对 PostUpdateWithMedia(status="", media="") 的简单调用会在 Twitter 上发布一张图片,但我如何使用它来发布多张图片。MonkehTweet 的 PostUpdateWithMedia 函数是,
<cffunction name="postUpdateWithMedia" access="public" output="false" hint="Updates the authenticating user's status. Request must be a POST. A status update with text identical to the authenticating user's current status will be ignored to prevent duplicates.">
<cfargument name="status" required="true" type="String" hint="The text of your status update. URL encode as necessary. Statuses over 140 characters will be forceably truncated." />
<cfargument name="media" required="true" type="string" hint="Up to max_media_per_upload files may be specified in the request, each named media[]. Supported image formats are PNG, JPG and GIF. Animated GIFs are not supported." />
<cfargument name="possibly_sensitive" required="false" type="boolean" default="false" hint="Set to true for content which may not be suitable for every audience." />
<cfargument name="in_reply_to_status_id" required="false" type="String" hint="The ID of an existing status that the update is in reply to." />
<cfargument name="lat" required="false" type="String" hint="The location's latitude that this tweet refers to." />
<cfargument name="long" required="false" type="String" hint="The location's longitude that this tweet refers to." />
<cfargument name="place_id" required="false" type="String" hint="A place in the world. These IDs can be retrieved from geo/reverse_geocode." />
<cfargument name="display_coordinates" required="false" type="String" hint="Whether or not to put a pin on the exact coordinates a tweet has been sent from." />
<cfargument name="checkHeader" required="false" type="boolean" default="false" hint="If set to true, I will abort the request and return the response headers for debugging." />
<cfargument name="timeout" required="false" type="string" default="#variables.instance.timeout#" hint="An optional timeout value, in seconds, that is the maximum time the cfhttp requests can take. If the time-out passes without a response, ColdFusion considers the request to have failed." />
<cfset var strTwitterMethod = '' />
<cfset arguments["media[]"] = arguments.media />
<cfset structDelete(arguments,'media') />
<cfset strTwitterMethod = getCorrectEndpoint('api') & 'statuses/update_with_media.json' />
<cfreturn genericAuthenticationMethod(timeout=getTimeout(), httpURL=strTwitterMethod,httpMethod='POST', parameters=arguments, checkHeader=arguments.checkHeader) />
</cffunction>
我尝试将多个文件传递为 PostUpdateWithMedia(status="", media="", media=""); 但它没有用。但是,我错误地传递了多个媒体的论点。有人可以帮助我如何传递多个媒体参数。
解决方案
不幸的是,MonkehTweet 不支持Twitter APImedia/upload
端点,这是多图像推文所必需的——它只支持已弃用的statuses/update_with_media
,它仍然有效,但只支持单个图像。我还注意到代码仍然引用了 140 个字符的推文,所以它可能已经有一段时间没有更新了。我也不知道 API 的替代 ColdFusion 包装器,所以这是您需要为自己构建的东西。
推荐阅读
- android - 安卓、数据库、谷歌地图
- javascript - JS解构成其他变量
- vb.net - 设置只读属性时,文件未在 VB.NET 中以只读方式打开
- c++ - 如何将在 Xcode 中创建的库用于另一个 Xcode 项目?
- docker - 当我删除它的图像时,docker 容器会发生什么?
- excel - 如何在 Excel 中禁用鼠标悬停的注释?
- c++ - std::allocator_traits::construct 调用错误的构造函数
- amazon-web-services - 如何修改存储桶策略以允许根凭证/IAM 用户
- spring - toPredicate 方法中的 CriteraQuery 不起作用
- reactjs - React auth0 PrivateRouter 结合 Redirect