Esempio n. 1
0
        private void MenuHiyobi_Click(object sender, RoutedEventArgs e)
        {
            MainPanel.Children.Clear();
            LabelSetup();
            InternetP    parser = new InternetP(url: "https://api.hiyobi.me/list/" + GetPage());
            HiyobiLoader hiyobi = new HiyobiLoader();

            hiyobi.FastDefault();
            parser.LoadJObject(hiyobi.FastParser);
        }
Esempio n. 2
0
        public async Task <Hitomi> Parser()
        {
            InternetP parser;

            parser = new InternetP(url: $"https://api.hiyobi.me/gallery/{text}");
            JObject obj = await parser.LoadJObject();

            parser = new InternetP(url: $"https://cdn.hiyobi.me/data/json/{text}_list.json");
            JArray imgs = await parser.TryLoadJArray();

            if (imgs == null)
            {
                return(null);
            }
            Hitomi h = new Hitomi
            {
                id         = obj.StringValue("id"),
                name       = obj.StringValue("title"),
                type       = type,
                page       = imgs.Count,
                dir        = $"https://hiyobi.me/reader/{text}",
                thumb      = ImageProcessor.LoadWebImage($"https://cdn.hiyobi.me/tn/{text}.jpg"),
                thumbpath  = $"https://cdn.hiyobi.me/tn/{text}.jpg",
                files      = imgs.ToList().Select(x => $"https://cdn.hiyobi.me/data/{text}/{x["name"]}").ToArray(),
                author     = string.Join(", ", obj["artists"].Select(x => x["display"].ToString())),
                authors    = obj["artists"].Select(x => x["display"].ToString()).ToArray(),
                Json       = obj,
                designType = new InternetP().DesignTypeFromInt(obj.IntValue("type") ?? 0),
                language   = obj.StringValue("language")
            };

            foreach (JToken tags in obj["tags"])
            {
                Tag tag = new Tag();
                if (tags["value"].ToString().Contains(":"))
                {
                    tag.types = (Tag.Types)Enum.Parse(typeof(Tag.Types), tags["value"].ToString().Split(':')[0]);
                }
                else
                {
                    tag.types = Tag.Types.tag;
                }
                tag.name = tags["display"].ToString();
                h.tags.Add(tag);
            }
            return(h);
        }