LordAshes / TaleSpire-BeyondLinkViaChrome

Unofficial TaleSpire plugin to extract D&D Beyond data, using Chrome Extension, and make it available in TS.
MIT License
0 stars 0 forks source link

Data brought from beyond is broken #7

Open NahtreX opened 2 years ago

NahtreX commented 2 years ago

Hi! I've been trying to get the character info from beyond but been failing. I think the JSON is getting malvormed since it comes down with a lot of extra characters, eg.:

"{\"Name\": \"\",\r\n\"Level\": \"1\",\r\n\"Race\": \"Tortle\",\r\n\"Class\": \"Wizard 1\",\r\n\"AC\": 17,\r\n\"HP\": {\r\n\"Current\": ,\r\n\"Max\": },\r\n\"HD\": {\r\n\"Used\": 0,\r\n\"Total\": 0,\r\n},\r\n\"Prof\": \"-1\",\r\n\"Move\": 30,\r\n\"Init\": \"-1\",\r\n\"Order\": \"-1\",\r\n\"Abilities\": {\r\n\"STR\": \"\",\r\n\"DEX\": \"\",\r\n\"CON\": \"\",\r\n\"INT\": \"\",\r\n\"WIS\": \"\",\r\n\"CHA\": \"\"\r\n},\r\n\"Saves\": {\r\n\"STR\": \"\",\r\n\"DEX\": \"\",\r\n\"CON\": \"\",\r\n\"INT\": \"\",\r\n\"WIS\": \"\",\r\n\"CHA\": \"\"\r\n},\r\n\"Skills\": {\r\n\"Acrobatics\": \"\",\r\n\"Animal Handling\": \"\",\r\n\"Arcana\": \"\",\r\n\"Athletics\": \"\",\r\n\"Deception\": \"\",\r\n\"History\": \"\",\r\n\"Insight\": \"\",\r\n\"Intimidation\": \"\",\r\n\"Investigation\": \"\",\r\n\"Medicine\": \"\",\r\n\"Nature\": \"\",\r\n\"Perception\": \"\",\r\n\"Performance\": \"\",\r\n\"Persuasion\": \"\",\r\n\"Religion\": \"\",\r\n\"Sleight of Hand\": \"\",\r\n\"Stealth\": \"\",\r\n\"Survival\": \"\"\r\n},\r\n\"Attacks\": {\r\n}}"

This is the issue reported by the tool:

Unhandled Exception: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: }. Path 'HP.Max', line 8, position 7. at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonTextReader.Read() at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateJObject(JsonReader reader) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value) at LordAshes.BeyondLinkServer.OnAccept(IAsyncResult result) in C:\Users\Lord Ashes\source\repos\TaleSpireBeyondLinkViaChromePlugin\BeyondLinkServer\BeyondLinkServer.cs:line 145 at System.Net.LazyAsyncResult.Complete(IntPtr userToken) at System.Net.ContextAwareResult.CompleteCallback(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Net.ContextAwareResult.Complete(IntPtr userToken) at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken) at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped nativeOverlapped) at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped pOVERLAP)

Am I doing something wrong on my side?

LordAshes commented 2 years ago

Looks like the extension is having issues reading your character info. I did update the extension today (sorry forgot to update the version...just remove the extension are re-add it) because DnD Beyond seemed to have changed the key that we were using to get the character name. After fixing that it loaded my character stats without a issue.

Lord Ashes

[image: width=] http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free.www.avg.com http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Sun, Aug 7, 2022 at 2:15 PM NahtreX @.***> wrote:

Hi! I've been trying to get the character info from beyond but been failing. I think the JSON is getting malvormed since it comes down with a lot of extra characters, eg.:

"{"Name": "",\r\n"Level": "1",\r\n"Race": "Tortle",\r\n"Class": "Wizard 1",\r\n"AC": 17,\r\n"HP": {\r\n"Current": ,\r\n"Max": },\r\n"HD": {\r\n"Used": 0,\r\n"Total": 0,\r\n},\r\n"Prof": "-1",\r\n"Move": 30,\r\n"Init": "-1",\r\n"Order": "-1",\r\n"Abilities": {\r\n"STR": "",\r\n"DEX": "",\r\n"CON": "",\r\n"INT": "",\r\n"WIS": "",\r\n"CHA": ""\r\n},\r\n"Saves": {\r\n"STR": "",\r\n"DEX": "",\r\n"CON": "",\r\n"INT": "",\r\n"WIS": "",\r\n"CHA": ""\r\n},\r\n"Skills": {\r\n"Acrobatics": "",\r\n"Animal Handling": "",\r\n"Arcana": "",\r\n"Athletics": "",\r\n"Deception": "",\r\n"History": "",\r\n"Insight": "",\r\n"Intimidation": "",\r\n"Investigation": "",\r\n"Medicine": "",\r\n"Nature": "",\r\n"Perception": "",\r\n"Performance": "",\r\n"Persuasion": "",\r\n"Religion": "",\r\n"Sleight of Hand": "",\r\n"Stealth": "",\r\n"Survival": ""\r\n},\r\n"Attacks": {\r\n}}"

This is the issue reported by the tool:

Unhandled Exception: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: }. Path 'HP.Max', line 8, position 7. at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonTextReader.Read() at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateJObject(JsonReader reader) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value) at LordAshes.BeyondLinkServer.OnAccept(IAsyncResult result) in C:\Users\Lord Ashes\source\repos\TaleSpireBeyondLinkViaChromePlugin\BeyondLinkServer\BeyondLinkServer.cs:line 145 at System.Net.LazyAsyncResult.Complete(IntPtr userToken) at System.Net.ContextAwareResult.CompleteCallback(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Net.ContextAwareResult.Complete(IntPtr userToken) at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken) at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped nativeOverlapped) at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped pOVERLAP)

Am I doing something wrong on my side?

— Reply to this email directly, view it on GitHub https://github.com/LordAshes/TaleSpire-BeyondLinkViaChrome/issues/7, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGQ5Y6GZRUMEWRA65QZRZ3LVX74MVANCNFSM5523EGNA . You are receiving this because you are subscribed to this thread.Message ID: @.***>