Esempio n. 1
0
        public override async Task <AutoHintItems> GetAutoHintItemsAsync(SearchPara para, CancellationToken token)
        {
            var          ahitems = new AutoHintItems();
            const string api     = "https://capi-v2.sankakucomplex.com";

            Net = Net == null ? new NetDocker(Settings, api) : Net.CloneWithOldCookie();
            var pairs = new Pairs
            {
                { "lang", "en" },
                { "tag", para.Keyword.ToEncodedUrl() },
                { "target", "post" },
                { "show_meta", "1" }
            };
            var json = await Net.GetJsonAsync($"{api}/tags/autosuggestCreating", token, pairs);

            foreach (var jitem in Extend.CheckListNull(json))
            {
                var ahitem = new AutoHintItem();
                ahitem.Word  = $"{jitem.name}";
                ahitem.Count = $"{jitem.count}";
                ahitems.Add(ahitem);
            }

            return(ahitems);
        }
Esempio n. 2
0
        public override async Task <AutoHintItems> GetAutoHintItemsAsync(SearchPara para, CancellationToken token)
        {
            var net   = new NetOperator(para.Site.Settings);
            var pairs = new Pairs
            {
                { "limit", "15" },
                { "order", "count" },
                { "name", para.Keyword }
            };
            var query = $"{HomeUrl}/tag.json{pairs.ToPairsString()}";
            var json  = await net.GetJsonAsync(query, token);

            var items = new AutoHintItems();

            foreach (var item in Extend.GetList(json))
            {
                var hintItem = new AutoHintItem();
                hintItem.Count = $"{item.count}";
                hintItem.Word  = $"{item.name}";
                items.Add(hintItem);
            }

            return(items);
        }