Esempio n. 1
0
        protected override async Task <ComicPage[]> GetPagesAsync(ComicChapter chapter)
        {
            if (Entity is null)
            {
                return(null);
            }
            var entity = await rootFetcher.FetchChapterAsync(Entity.ComicUrl, chapter.TargetUrl);

            return(entity?.Pages);
        }
Esempio n. 2
0
        public async Task <IActionResult> GetChapter([FromQuery] string url, [FromQuery] string entityUrl)
        {
            if (string.IsNullOrEmpty(url))
            {
                return(BadRequest());
            }
            var key = KeyGenerator.Concat(ChapterKey, url);
            var res = memoryCache.Get <WithPageChapter>(key);

            if (res != null)
            {
                return(Ok(res));
            }
            res = await rootFetcher.FetchChapterAsync(url, entityUrl);

            if (res != null)
            {
                memoryCache.Set(key, res, new MemoryCacheEntryOptions
                {
                    SlidingExpiration = CacheTime
                });
            }
            return(Ok(res));
        }