Skip to content

Commit

Permalink
Fix issue #520 Failed to determine login name
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas694 committed Apr 14, 2024
1 parent 5d4acd3 commit 6db5ab5
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,11 @@ private static string ExtractUsername(Provider provider, string document)
case Provider.Tumblr:
var regex = new Regex("window\\['___INITIAL_STATE___'] = ({.*});");
var json = regex.Match(document ?? "").Groups[1].Value;
if (string.IsNullOrEmpty(json))
{
regex = new Regex("id=\"___INITIAL_STATE___\">\\s*?({.*})\\s*?</script>", RegexOptions.Singleline);
json = regex.Match(document ?? "").Groups[1].Value;
}
var obj = JObject.Parse(json.Replace(":undefined", ":null"));
var value = obj["Settings"];
if (value == null) return null;
Expand Down

0 comments on commit 6db5ab5

Please sign in to comment.