Beispiel #1
0
        public async Task <ActionResult <List <int> > > Get(string query, string url, string countryCode)
        {
            if (!UrlHelper.isValidUrl(url) || !UrlHelper.isValidCountryCode(countryCode))
            {
                return(BadRequest());
            }

            var results = await GoogleScrapper.GoogleResultsScrapper(query, url, countryCode, _appSettings.NumberOfResults);

            return(results);
        }
        public async Task GoogleScrappingJob(string query, string url, string countryDomain, int recurringKeyworId)
        {
            var results = await GoogleScrapper.GoogleResultsScrapper(query, url, countryDomain, _appSettings.NumberOfResults);

            _context.RecurringKeywordPosition.Add(new RecurringKeywordPosition
            {
                RecurringKeyworId = recurringKeyworId,
                Date      = DateTime.Now,
                Positions = string.Join(", ", results)
            });
            await _context.SaveChangesAsync();
        }