[CHANGE] Split up json parsing, added getting account info
This commit is contained in:
@@ -5,7 +5,7 @@ namespace Manager.YouTube.Parsers;
|
||||
|
||||
public static class HtmlParser
|
||||
{
|
||||
public static Result<(string, string)> GetStateJson(string html)
|
||||
public static Result<(string, bool)> GetStateJson(string html)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(html))
|
||||
{
|
||||
@@ -21,14 +21,15 @@ public static class HtmlParser
|
||||
return ResultError.Fail($"Could not find {setFunction} in html script nodes!");
|
||||
|
||||
var json = ExtractJson(scriptNode.InnerText, "ytcfg.set(");
|
||||
var jsonText = ExtractJson(scriptNode.InnerText, "setMessage(");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(json) || string.IsNullOrWhiteSpace(jsonText))
|
||||
if (string.IsNullOrWhiteSpace(json))
|
||||
{
|
||||
return ResultError.Fail($"Could not find {setFunction} in html script nodes!");
|
||||
}
|
||||
|
||||
return (json, jsonText);
|
||||
var isPremiumUser = html.Contains("logo-type=\"YOUTUBE_PREMIUM_LOGO\"", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
return (json, isPremiumUser);
|
||||
}
|
||||
|
||||
static string? ExtractJson(string input, string marker)
|
||||
|
Reference in New Issue
Block a user