当前位置: 首页>>代码示例>>C#>>正文


C# IElement.QuerySelectorAll方法代码示例

本文整理汇总了C#中IElement.QuerySelectorAll方法的典型用法代码示例。如果您正苦于以下问题:C# IElement.QuerySelectorAll方法的具体用法?C# IElement.QuerySelectorAll怎么用?C# IElement.QuerySelectorAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IElement的用法示例。


在下文中一共展示了IElement.QuerySelectorAll方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetReleaseInfo

        private ReleaseInfo GetReleaseInfo(IElement row, IElement downloadAnchor, string title, int category)
        {
            // Parse required data
            var downloadAnchorHref = downloadAnchor.Attributes["href"].Value;
            var torrentId = downloadAnchorHref.Substring(downloadAnchorHref.LastIndexOf('=') + 1);
            var qFiles = row.QuerySelector("td:nth-last-child(6)");
            var files = ParseUtil.CoerceLong(qFiles.TextContent);
            var publishDate = DateTime.ParseExact(row.QuerySelector(".time.tooltip").Attributes["title"].Value, "MMM dd yyyy, HH:mm", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal).ToLocalTime();
            var torrentData = row.QuerySelectorAll(".number_column"); // Size (xx.xx GB[ (Max)]) Snatches (xx) Seeders (xx) Leechers (xx)

            if (torrentData.Length != 4)
                throw new Exception($"We expected 4 torrent datas, instead we have {torrentData.Length}.");

            if (torrentId.Contains('#'))
                torrentId = torrentId.Split('#')[0];

            var size = ReleaseInfo.GetBytes(torrentData[0].TextContent);
            var grabs = int.Parse(torrentData[1].TextContent);
            var seeders = int.Parse(torrentData[2].TextContent);
            var guid = new Uri(GuidUrl + torrentId);

            // Build releaseinfo
            return new ReleaseInfo
            {
                Title = title,
                Description = title,
                Category = category, // Who seasons movies right
                Link = new Uri(DownloadUrl + torrentId),
                PublishDate = publishDate,
                Seeders = seeders,
                Peers = seeders,
                Files = files,
                Size = size,
                Grabs = grabs,
                Guid = guid,
                Comments = guid,
                DownloadVolumeFactor = 0, // ratioless tracker
                UploadVolumeFactor = 1
            };
        }
开发者ID:Jackett,项目名称:Jackett,代码行数:40,代码来源:MoreThanTV.cs

示例2: Map

        private static WebElement Map(IElement node)
        {
            if (node == null)
                return null;

            var el = new WebElement(value => node.SetAttribute("value", value))
            {
                Attributes = node.Attributes.ToDictionary(x => x.Name, y => y.Value),
                TagName = node.TagName,
                Text = node.TextContent,
                InnerHtml = node.InnerHtml,
                OuterHtml = node.OuterHtml
            };

            el.OnQuerySelector(query => Map(node.QuerySelector(query)));
            el.OnQuerySelectorAll(query => node.QuerySelectorAll(query).Select(Map));

            return el;
        }
开发者ID:hackerzpf,项目名称:ghost-crawler-1,代码行数:19,代码来源:AngleSharpProvider.cs

示例3: RemoveEmptyTags

 private void RemoveEmptyTags(IElement rootElement)
 {
     foreach (IElement el in rootElement.QuerySelectorAll("div,span"))
     {
         if (string.IsNullOrWhiteSpace(el.TextContent) && el.ChildElementCount == 0)
         {
             el.Remove();
         }
     }
 }
开发者ID:Mitch528,项目名称:WebNovelConverter,代码行数:10,代码来源:RoyalRoadLSource.cs

示例4: ExpandSpoilers

        /// <summary>
        /// Expands spoilers in HTML for easy reading.
        /// Expects:
        ///     <div class="spoiler_header">Spoilerxxx</div>
        ///     <div class="spoiler_body" style="display: none;">xxxx</div>
        /// </summary>
        /// <param name="rootElement"></param>
        protected void ExpandSpoilers(IElement rootElement)
        {
            foreach (IElement el in rootElement.QuerySelectorAll(".spoiler_body"))
            {
                el.SetAttribute("style", string.Empty);
                el.SetAttribute("class", string.Empty);

            }

            foreach (IElement el in rootElement.QuerySelectorAll(".spoiler_header"))
            {
                el.Remove();
            }
        }
开发者ID:Mitch528,项目名称:WebNovelConverter,代码行数:21,代码来源:RoyalRoadLSource.cs

示例5: RemoveDonation

 protected virtual void RemoveDonation(IElement rootElement)
 {
     foreach (var el in rootElement.QuerySelectorAll("div.thead"))
     {
         if (el.TextContent.Contains("Donation for the Author"))
             el.Remove();
     }
 }
开发者ID:Mitch528,项目名称:WebNovelConverter,代码行数:8,代码来源:RoyalRoadLSource.cs

示例6: RemoveNavigation

        protected virtual void RemoveNavigation(IElement rootElement)
        {
            // Last 1-2 tables might be navigation

            foreach (var table in rootElement.QuerySelectorAll("table").Reverse().Take(2))
            {
                if (table.QuerySelectorAll("a").Any(x => x.TextContent.Contains("Chapter")))
                {
                    table.Remove();
                }
            }
        }
开发者ID:Mitch528,项目名称:WebNovelConverter,代码行数:12,代码来源:RoyalRoadLSource.cs


注:本文中的IElement.QuerySelectorAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。