Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safebooru doesn't appear to be working for me #52

Open
catgirlkara opened this issue Sep 30, 2024 · 5 comments
Open

Safebooru doesn't appear to be working for me #52

catgirlkara opened this issue Sep 30, 2024 · 5 comments

Comments

@catgirlkara
Copy link

catgirlkara commented Sep 30, 2024

var booru = new BooruSharp.Booru.Safebooru();
PostSearchResult? result = null;
try
{
result = await booru.GetRandomPostAsync();
}
catch (Exception e)
{
Console.WriteLine(e);
}

Throws this exception:

System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $[0].directory | LineNumber: 0 | BytePositionInLine: 336.
---> System.InvalidOperationException: Cannot get the value of a token type 'Number' as a string.
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ExpectedString(JsonTokenType tokenType)
at System.Text.Json.Utf8JsonReader.GetString()
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue) at System.Text.Json.Serialization.JsonCollectionConverter2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue) at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo1 jsonTypeInfo, Nullable1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 json, JsonTypeInfo1 jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
at BooruSharp.Booru.ABooru.GetDataAsync[T](Uri url)
at BooruSharp.Booru.Template.Gelbooru02.GetPostSearchResultAsync(Uri uri)
at BooruSharp.Booru.ABooru.GetRandomPostAsync(String[] tagsArg)

@catgirlkara
Copy link
Author

Also just wanted to say that your API is amazing and easy to use! Thanks <3

@Xwilarg
Copy link
Owner

Xwilarg commented Sep 30, 2024

Hey, thanks for the bug report, could you please tell me which version of the library you are using?

@catgirlkara
Copy link
Author

i pulled the latest i could find on nuget. looks like 4.0.0-beta?

@catgirlkara
Copy link
Author

I rolled back to 3.6.0 and Safebooru works! TY

@Xwilarg
Copy link
Owner

Xwilarg commented Oct 2, 2024

Good to know, I'll still have a look at beta to see if I can do something, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants