Closed sepp89117 closed 2 years ago
Solved!
The shortDescription of this Video contains two '}'. The Json extraction function misinterprets the character because it does not recognize that it is within a quoted string.
Fixed function: 'Helpers/Json.cs' -> 'public static string Extract(string source)'
public static string Extract(string source)
{
StringBuilder sb = new StringBuilder();
int depth = 0;
char lastChar = '\u0000';
bool isString = false;
foreach (var ch in source)
{
sb.Append(ch);
//First, set bool if we are in a quoted String
if(ch == '"' && lastChar != '\\')
{
isString = !isString;
}
//Don't change depth if we are in String
if (!isString)
{
if (ch == '{' && lastChar != '\\')
depth++;
else if (ch == '}' && lastChar != '\\')
depth--;
}
if (depth == 0)
break;
lastChar = ch;
}
return sb.ToString();
}
@sepp89117 can you do pull request ?
any update ?
I'm really sorry! I hardly find time for the hobby... You can simply copy the code if you want.
I opened a pull request
fixed in 3.2.1
Newtonsoft.Json.JsonReaderException: Unterminated string. Expected delimiter: ". Path 'videoDetails.shortDescription', line 1, position 56218. YouTube.cs:Line 72 try to downloading URL https://www.youtube.com/watch?v=U2XK_TJZ3PI