node.js - 如何使用包 twi 发送图像 vie url
问题描述
我想发送带有图像的推文,但图像来自 url。我不知道该怎么做,但我认为这与仅在您的 PC 上拥有图像文件并没有太大不同,因为实际的 url 以 .jpg/.png 结尾。
module.exports = (message, imageURL) => {
T.post("media/upload", { media: imageURL }, function (error, media, response) {
if (error) {
console.log(error)
} else {
const status = {
status: message,
media_ids: media.media_id_string
}
T.post("statuses/update", status, function (error, tweet, response) {
if (error) {
console.log(error)
} else {
console.log("Successfully tweeted an image!")
}
})
}
})
};
我是整个 twit 包的新手,所以我确定我只是忽略了它,但任何帮助将不胜感激。
解决方案
推荐阅读
- jquery - 如何为数据表中动态添加的子行添加背景颜色?
- oracle-sqldeveloper - 通过在 SQL developer 中执行脚本导出 xlsx 文件
- themes - Shopify 主题许可证
- c# - Web 应用程序中的 Newtonsoft.Json 6.0.0.0 和 12.0.0.0 与 Web Api、C# 冲突
- android - 如何在 Android Studio 中添加平板电脑分辨率支持
- swagger - 在 Nest.js 项目中添加 Swagger 基本路径字段
- mysql - 在mysql中选择多个表的公共值
- .net - 您可以从常规 .net 应用程序中使用 Roslyn 编译器吗?
- python - 使用 Socket 网络后端创建 QEMU 桥接器
- sql - 将多个 SQL Server 表合并为一个