示例#1
0
        private IllustInfo GetIllustInfo(string id, string html)
        {
            CQ  cq         = html;
            var illustInfo = new IllustInfo();

            illustInfo.Id            = id;
            illustInfo.BookmarkCount = cq[".bookmark-count"].Eq(0).Text().ToInt();
            illustInfo.IsBookmarked  = cq["span.button.btn-like.done"].Length > 0;
            var ids = Regex.Matches(html, @"<li id=""il(?<id>\d+)""").Cast <Match>().Select(x => x.Groups["id"].Value).Distinct();

            illustInfo.ids       = ids.Where(d => d != id).ToArray();
            illustInfo.pagecount = cq[".img-box .page-count"].Text().ToIntNullable() ?? 1;
            illustInfo.tags      = cq[".tag"].Selection.Select(x => x.TextContent.Replace("* ", "")).ToArray();
            return(illustInfo);
        }
示例#2
0
        private void ProcessIllust(IllustInfo info)
        {
            Console.Write($", bookmark: {info.IsBookmarked}:{info.BookmarkCount}, page: {info.pagecount}");
            var badtags = info.tags.Intersect(_badTags).ToList();

            if (_settings.EnableTagFilter && badtags.Any())
            {
                Console.Write($", skiped {string.Join(",", badtags)}");
            }
            else if (info.IsBookmarked)
            {
                Console.Write($", skiped bookmarked.");
            }
            else if (info.BookmarkCount >= _settings.MinCount && info.pagecount <= _settings.MaxIllustPageCount)
            {
                int restrict = 0;
                if (_settings.R18InPrivate && Regex.IsMatch(string.Join(",", info.tags), @"r(-)?18", RegexOptions.IgnoreCase))
                {
                    restrict = 1;
                }
                Console.Write($", restrict: {restrict}");
                var re = AddBookmark(info.Id, restrict);
                if (re)
                {
                    Console.Write(", succeed");
                }
                else
                {
                    Console.Write(", failed");
                }
            }
            else
            {
                Console.Write(", skiped");
            }
        }