本文介绍了如何在直接消息中发送图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 python + tweepy 在直接消息中发送图像,但没有成功.它显示为传入消息中的链接.
I'm trying to send an image in direct message using python + tweepy but no luck.It showed as a link in incoming messages.
imgurl = 'https://t.co/***'
api.send_direct_message(screen_name='username',text=' '+imgurl)
你能指点一下吗?官方 Twitter API 也没有为我提供帮助.
Could you please advise?Official Twitter API doesn't shed a light for me as well.
推荐答案
目前,您正在发送链接.字面上的状态消息,其中文本是 URL.
At the moment, you are sending a link. Literally a status message where the text is a URL.
遗憾的是,Twitter 不提供通过 DM 上传图片的 API 访问.
如果您能够使用 Twitter 的私有 API,您应该能够将 media_id
附加到您的 DM.但除此之外,你运气不好.
If you are able to use Twitter's private API, you should be able to attach a media_id
to your DM. But other than that, you're out of luck.
对不起.
这篇关于如何在直接消息中发送图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!