Files
jellyfin-plugin-danmu/Jellyfin.Plugin.Danmu/Core/Extensions/ElementExtension.cs
2023-02-02 21:55:54 +08:00

58 lines
1.6 KiB
C#

// using AngleSharp.Dom;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Jellyfin.Plugin.Danmu.Core.Extensions
{
public static class ElementExtension
{
// public static string? GetText(this IElement el, string css)
// {
// var node = el.QuerySelector(css);
// if (node != null)
// {
// return node.Text().Trim();
// }
// return null;
// }
// public static string GetTextOrDefault(this IElement el, string css, string defaultVal = "")
// {
// var node = el.QuerySelector(css);
// if (node != null)
// {
// return node.Text().Trim();
// }
// return defaultVal;
// }
// public static string? GetAttr(this IElement el, string css, string attr)
// {
// var node = el.QuerySelector(css);
// if (node != null)
// {
// var attrVal = node.GetAttribute(attr);
// return attrVal != null ? attrVal.Trim() : null;
// }
// return null;
// }
// public static string? GetAttrOrDefault(this IElement el, string css, string attr, string defaultVal = "")
// {
// var node = el.QuerySelector(css);
// if (node != null)
// {
// var attrVal = node.GetAttribute(attr);
// return attrVal != null ? attrVal.Trim() : defaultVal;
// }
// return defaultVal;
// }
}
}