[英]Tweepy API: add tags / mentions to attached photo
I have created a twitter bot using the Tweepy API.我使用 Tweepy API 创建了一个 twitter 机器人。 It works great, it tweets a tweet with a photo attached to it.
它工作得很好,它会发布一条附有照片的推文。 However, I would like to add "mentions" or "In this photo" @accounts (tags) to the attached image.
但是,我想在附加的图像中添加“提及”或“在这张照片中”@accounts(标签)。 This is possible on twitter.
这在 twitter 上是可能的。 I have red the Tweepy documentation and searched online, looking for a parameter but I could not find anything.
我红了Tweepy文档并在线搜索,寻找参数但我找不到任何东西。 Any suggestion would appriciated!
任何建议都会受到重视!
code snippet:代码片段:
api = tweepy.API(oauth)
api.update_with_media(filename='screenshot.png', status=masterStatus)
First of all, please do not use update_with_media
, as this is a deprecated API.首先,请不要使用
update_with_media
,因为这是已弃用的 API。 It works for now, but will get no support.它现在可以工作,但不会得到支持。 The current correct route is the two-step use of
media_upload
, followed by update_status
(you can also add image alt text using create_media_metadata
in between those two steps, if you like).当前正确的路线是使用
media_upload
的两步,然后是update_status
(如果您愿意,也可以在这两个步骤之间使用create_media_metadata
添加图像替代文本)。 The Tweepy 3.9.0 documentation mentions this. Tweepy 3.9.0 文档提到了这一点。
For the main part of the question - the Twitter API itself does not currently support adding people tags to images, so this is also unavailable in Tweepy.对于问题的主要部分 - Twitter API 本身目前不支持向图像添加人物标签,因此在 Tweepy 中也不可用。 If you would like to request this feature in a future version of the Twitter API, you can do so here .
如果您想在 Twitter API 的未来版本中请求此功能,您可以在此处进行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.