Ejemplo n.º 1
0
        public async Task <HashTagData[]> Get(Classes.Models.Location.Location location)
        {
            if (location == null)
            {
                log.LogInformation("Location is not set.");
                return(new HashTagData[] { });
            }

            log.LogInformation("Extracting popular tags...");
            try
            {
                var topMedia = await instagram.Resilience.WebPolicy
                               .ExecuteAsync(
                    () => ResultExtension.UnWrap(() => instagram.LocationProcessor.GetTopLocationFeedsAsync(location.Pk, PaginationParameters.MaxPagesToLoad(1)), log))
                               .ConfigureAwait(false);

                return(await smartTags.Get(topMedia).ConfigureAwait(false));
            }
            catch (Exception e)
            {
                log.LogError(e, "Failed");
            }

            log.LogWarning("Top media query failed");
            return(new HashTagData[] { });
        }
Ejemplo n.º 2
0
        public async Task <HashTagData[]> Get(HashTagData tag)
        {
            if (tag == null)
            {
                throw new ArgumentNullException(nameof(tag));
            }

            log.LogInformation("Extracting popular tags for [{0}]...", tag);
            try
            {
                var topMedia = await instagram.Resilience.WebPolicy
                               .ExecuteAsync(
                    () => ResultExtension.UnWrap(() => instagram.HashtagProcessor.GetTopHashtagMediaListAsync(tag.Text, PaginationParameters.MaxPagesToLoad(10)), log))
                               .ConfigureAwait(false);

                return(await smartTags.Get(topMedia).ConfigureAwait(false));
            }
            catch (Exception e)
            {
                log.LogError(e, "Failed");
            }

            log.LogWarning("Top media query failed");
            return(new HashTagData[] { });
        }