gpt4 book ai didi

C# InstaSharper : Unable to upload photo: Unexpected character encountered while parsing value: S. 路径 '',第 0 行,位置 0

转载 作者:行者123 更新时间:2023-12-05 07:16:51 24 4
gpt4 key购买 nike

我将此库用作 Instagram 机器人程序的 NuGet 包 (InstaSharper):https://github.com/a-legotin/InstaSharper

而在 InsertImage(); 函数中,该函数用于将照片上传到 instagram 页面,在解析时,程序遇到问题,控制台返回:

Loged in! Unable to upload photo: Unexpected character encountered while parsing value: S. Path '', line 0, position 0.

我尝试使用不同的路径和图像类型,但同样的事情发生了。

可能是什么问题以及如何解决?

这些是主要功能:

static void Main(string[] args)
{
user = new UserSessionData();
user.UserName = username;
user.Password = password;

Login();
Console.Read();
}

public static async void Login()
{
api = InstaApiBuilder.CreateBuilder().SetUser(user).UseLogger(new DebugLogger(LogLevel.Exceptions)).SetRequestDelay(RequestDelay.FromSeconds(1, 3)).Build();

var loginRequest = await api.LoginAsync();
if (loginRequest.Succeeded)
{
Console.WriteLine("Loged in!");
InsertImage(@"C:\test.jpg", "Testing");
}
else Console.WriteLine("Unable to log in: " + loginRequest.Info.Message);
}

public static async void InsertImage(string _path, string _caption)
{
var mediaImage = new InstaImage
{
Height = 1080,
Width = 1080,
URI = new Uri(Path.GetFullPath(_path), UriKind.Absolute).LocalPath
};
var result = await api.UploadPhotoAsync(mediaImage, _caption);
if (result.Succeeded == true) Console.WriteLine($"Media created: {result.Value.Pk}, {result.Value.Caption}");
else Console.WriteLine($"Unable to upload photo: {result.Info.Message}");

}

最佳答案

似乎 InstaSharper Nuget 包没有更新,我已经从 Github 下载它并在我的项目中使用它,它对我有用

希望对你有帮助

关于C# InstaSharper : Unable to upload photo: Unexpected character encountered while parsing value: S. 路径 '',第 0 行,位置 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59010949/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com