Exemplo n.º 1
0
        public String Add([FromBody] CorpusContentDto obj)
        {
            var content = new CorpusContent();

            try
            {
                content = new CorpusContent()
                {
                    Id           = -1,
                    CorpusId     = obj.CorpusId,
                    Name         = obj.Name,
                    Content      = Encoding.ASCII.GetBytes(obj.Content),
                    Type         = obj.Type,
                    Hash         = ScraperUtilities._hashContent(Encoding.ASCII.GetBytes(obj.Content)),
                    DownloadDate = DateTime.Now,
                    ScraperType  = "Manual Insert",
                };

                m_context.CorpusContentRepository.Add(content);
            }
            catch (Exception e)
            {
                return(e.ToString());
            }

            return("All Good");
        }
Exemplo n.º 2
0
        private async Task <IEnumerable <Meeting> > SetMeetingList()
        {
            var scraperUtility = new ScraperUtilities();
            var textUtility    = new TextUtility();
            var url            = "https://meetings.ca.org/api/v1/meetings?area=Sweden&current_day=0&order=city";
            var handler        = new HttpClientHandler();
            var httpClient     = new HttpClient(handler, false);
            var response       = await httpClient.GetAsync(url);

            var caMeetings = new List <CAJsonToClass>();
            var culture    = new CultureInfo("sv-SE");

            if (response.IsSuccessStatusCode)
            {
                var stream = await response.Content.ReadAsStreamAsync();

                var ret = scraperUtility.DeserializeFromStream(stream).ToString();
                caMeetings = JsonConvert.DeserializeObject <List <CAJsonToClass> >(ret);
            }
            var meetingList = new List <Meeting>();

            if (null != caMeetings && caMeetings.Any())
            {
                var dayAndTime = new List <MeetingSpecific>();
                foreach (var caMeeting in caMeetings.OrderBy(m => m.group.name, StringComparer.Create(culture, false)))
                {
                    var meeting      = new Meeting();
                    var meetingExist = false;
                    if (meetingList.Any(m => m.GroupName.Trim() == caMeeting.group.name.Trim()))
                    {
                        meeting      = meetingList.Where(m => m.GroupName.Trim() == caMeeting.group.name.Trim()).FirstOrDefault();
                        meetingExist = true;
                    }
                    if (!meetingExist)
                    {
                        meeting.Id           = caMeeting.group.id;
                        meeting.GroupName    = caMeeting.group.name.Trim();
                        meeting.Email        = caMeeting.group.email;
                        meeting.Phone        = caMeeting.group.phone;
                        meeting.GroupLink    = caMeeting.group.web;
                        meeting.Address.City = !string.IsNullOrWhiteSpace(caMeeting.group.location.localized_city)
                                                        ? caMeeting.group.location.localized_city
                                                        : caMeeting.group.location.city;
                        meeting.Address.Street = !string.IsNullOrWhiteSpace(caMeeting.group.location.localized_road)
                                                        ? caMeeting.group.location.localized_road
                                                        : caMeeting.group.location.road;
                        var district = new District
                        {
                            DistrictName = !string.IsNullOrWhiteSpace(caMeeting.group.location.localized_county)
                                                        ? caMeeting.group.location.localized_county
                                                        : caMeeting.group.location.county,
                            Id = caMeeting.group.id
                        };
                        var districtsList = new List <District> {
                            district
                        };
                        meeting.Address.Districts = districtsList.AsEnumerable();
                        var success = double.TryParse(caMeeting.group.location.lng, out double longLat);
                        meeting.Address.Longitude = (success) ? longLat : 0;
                        success = double.TryParse(caMeeting.group.location.lat, out longLat);
                        meeting.Address.Lattitude = (success) ? longLat : 0;
                        meeting.Language          = caMeeting.group.location.language;
                        Regex regEx       = new Regex(@"(https?://[^\s]+)");
                        var   description = caMeeting.description.Replace("\r\n", "<br>");
                        description = regEx.Replace(description, "<a href=\"$1\" target=\"_blank\">$1</a>");
                        meeting.AdditionalInformationHtmlString = description;
                        meeting.Note = caMeeting.group.description;
                        meeting.Address.LocationLink = string.Format("https://maps.google.com/maps?q={0}",
                                                                     caMeeting.group.location.localized_formatted_address);
                        meeting.Address.LocalizedAddress = !string.IsNullOrWhiteSpace(caMeeting.group.location.localized_formatted_address)
                                                        ? caMeeting.group.location.localized_formatted_address
                                                        : caMeeting.group.location.formatted_address;
                    }
                    var meetingSpecifics = new MeetingSpecific();
                    var tags             = new List <MeetingTypes>();
                    foreach (var tag in caMeeting.tags)
                    {
                        var type = scraperUtility.GetMeetingTypesCA(tag.word);
                        if (type == MeetingTypes.NotSet)
                        {
                            continue;
                        }
                        tags.Add(type);
                    }
                    meetingSpecifics.MeetingTypes = tags.AsEnumerable();
                    if (tags.Any())
                    {
                        meetingSpecifics.MeetingType = tags[0];
                    }
                    var meetingDay = (int)Enum.Parse(typeof(WeekdayNames), caMeeting.day);
                    meetingSpecifics.Id         = meetingDay;
                    meetingSpecifics.MeetingDay = meetingDay;
                    DateTime.TryParse(caMeeting.time, out DateTime dateTime);
                    TimeSpan startTime = dateTime.TimeOfDay;
                    TimeSpan endTime   = dateTime.AddMinutes(caMeeting.duration).TimeOfDay;
                    meetingSpecifics.StartTime = startTime;
                    meetingSpecifics.EndTime   = endTime;
                    dayAndTime = (null != meeting.DayAndTime && meeting.DayAndTime.Any())
                                                ? meeting.DayAndTime.ToList()
                                                : new List <MeetingSpecific>();
                    if (null != dayAndTime && !dayAndTime.Any())
                    {
                        for (var t = 0; t < 7; t++)
                        {
                            dayAndTime.Add(new MeetingSpecific {
                                MeetingDay = t, StartTime = TimeSpan.FromTicks(0), EndTime = TimeSpan.FromTicks(0)
                            });
                        }
                    }
                    if (null != dayAndTime)
                    {
                        if (dayAndTime.Any() && !dayAndTime.Contains(meetingSpecifics) && null == dayAndTime.FirstOrDefault(d => d.MeetingDay == meetingSpecifics.MeetingDay &&
                                                                                                                            meetingSpecifics.StartTime.Ticks == d.StartTime.Ticks) && meetingSpecifics.StartTime.Ticks > 0)
                        {
                            for (var t = 0; t < 7; t++)
                            {
                                dayAndTime.Add(new MeetingSpecific {
                                    MeetingDay = t, StartTime = TimeSpan.FromTicks(0), EndTime = TimeSpan.FromTicks(0)
                                });
                            }
                        }
                        for (var t = 0; t < dayAndTime.Count; t++)
                        {
                            if (dayAndTime.Contains(meetingSpecifics) || meetingSpecifics.StartTime.Ticks <= 0)
                            {
                                continue;
                            }
                            if (dayAndTime[t].MeetingDay == meetingSpecifics.MeetingDay && dayAndTime[t].StartTime.Ticks <= 0 && meetingSpecifics.StartTime.Ticks > 0)
                            {
                                dayAndTime[t] = meetingSpecifics;
                            }
                        }
                    }
                    var lastRow = (dayAndTime.Count > 7) ? dayAndTime.GetRange(dayAndTime.Count - 7, 7).Sum(t => t.StartTime.Ticks) : -1;
                    if (lastRow <= 0)
                    {
                        dayAndTime.RemoveRange(dayAndTime.Count - 7, 7);
                    }
                    meeting.DayAndTime = dayAndTime.AsEnumerable();

                    if (meetingExist)
                    {
                        var indexMeeting = meetingList.Where(m => m.GroupName.Trim() == caMeeting.group.name.Trim()).FirstOrDefault();
                        var index        = meetingList.IndexOf(indexMeeting);
                        if (index != -1)
                        {
                            meetingList[index] = meeting;
                        }
                    }
                    else
                    {
                        meetingList.Add(meeting);
                    }
                }
            }

            return(meetingList);
        }
Exemplo n.º 3
0
        private async Task <IEnumerable <Meeting> > SetMeetingList()
        {
            var scraperUtility = new ScraperUtilities();
            var textUtility    = new TextUtility();
            //choose your website
            var url = "http://www.aa.se/aa-moten?search_term=&days_selection=&";
            //get the html page source
            var httpClient = new HttpClient();
            var html       = await httpClient.GetStringAsync(url);

            //store the html of the page in a variable
            var doc = new HtmlDocument();

            doc.LoadHtml(html);
            var meetingList  = new List <Meeting>();
            var meetingNodes = doc.DocumentNode.SelectNodes("//div[contains(@class, 'search-meetings-results-item')]");
            var culture      = new CultureInfo("sv-SE");
            var orderedList  = meetingNodes.OrderBy(mn => mn.Descendants("h3").FirstOrDefault().InnerText.Split(new string[] { "," },
                                                                                                                StringSplitOptions.RemoveEmptyEntries).FirstOrDefault().Trim());

            foreach (var meetingNode in orderedList)
            {
                var meeting = new Meeting
                {
                    Id = int.Parse(meetingNode.Attributes["id"].Value.Replace("node-", "").Trim())
                };
                var fields             = meetingNode.SelectNodes(".//div[contains(@class, 'field')]");
                var title              = meetingNode.Descendants("h3").FirstOrDefault().InnerText;
                var isHandicapFriendly = null != meetingNode.Descendants("h3").FirstOrDefault().ChildNodes.Where(n => n.HasAttributes &&
                                                                                                                 null != n.Attributes["class"] &&
                                                                                                                 n.Attributes["class"].Value.Contains("circle")).FirstOrDefault();
                meeting.HandicapFriendly = isHandicapFriendly;
                var titleArray = title.Split(new string[] { "," },
                                             StringSplitOptions.RemoveEmptyEntries);
                meeting.GroupName = !string.IsNullOrWhiteSpace(titleArray.FirstOrDefault())
                                        ? titleArray.FirstOrDefault().Trim()
                                        : string.Empty;
                if (null != titleArray && titleArray.Length > 1)
                {
                    var districtsList = new List <District>();
                    for (int i = 1; i < titleArray.Length; i++)
                    {
                        var district = new District();
                        district.Id           = i;
                        district.DistrictName = titleArray[i];
                        districtsList.Add(district);
                    }
                    meeting.Address.Districts = new List <District>();
                    meeting.Address.Districts = districtsList;
                }
                var locationNode = fields.Where(n => n.HasAttributes &&
                                                null != n.Attributes["class"] &&
                                                !n.Attributes["class"].Value.Contains("field-label")).FirstOrDefault();
                var locationLink = (null != locationNode) ? locationNode.SelectNodes(".//a") : null;
                var locationUrl  = (null != locationLink &&
                                    null != locationLink.FirstOrDefault() &&
                                    locationLink.FirstOrDefault().HasAttributes &&
                                    null != locationLink.FirstOrDefault().Attributes["href"])
                                                                ? locationLink.FirstOrDefault().Attributes["href"].Value.Trim()
                                                                : string.Empty;
                meeting.Address.LocationLink = (null != locationLink) ? locationUrl : string.Empty;
                var address = null != locationLink &&
                              null != locationLink.FirstOrDefault() &&
                              locationLink.FirstOrDefault().HasAttributes &&
                              null != locationLink.FirstOrDefault().InnerText
                                                                ? locationLink.FirstOrDefault().InnerText.Trim()
                                                                : string.Empty;
                if (address.Contains(','))
                {
                    var addressArray = address.Split(',');
                    meeting.Address.Street = addressArray[0].Trim();
                    meeting.Address.City   = addressArray[1].Trim();
                }
                else
                {
                    meeting.Address.Street = address;
                    meeting.Address.City   = string.Empty;
                }
                var place = fields.Where(n => n.HasAttributes &&
                                         null != n.Attributes["class"] &&
                                         n.ParentNode.Attributes["class"].Value.Contains("field-name-field-place") &&
                                         !n.Attributes["class"].Value.Contains("field-label")).FirstOrDefault();
                meeting.Place = null != place && !string.IsNullOrWhiteSpace(place.InnerText.Trim())
                                                                ? place.InnerText.Trim()
                                                                : string.Empty;
                var phone = fields.Where(n => n.HasAttributes &&
                                         null != n.Attributes["class"] &&
                                         n.ParentNode.Attributes["class"].Value.Contains("field-name-field-phone") &&
                                         !n.Attributes["class"].Value.Contains("field-label")).FirstOrDefault();
                meeting.Phone = null != phone && !string.IsNullOrWhiteSpace(phone.InnerText.Trim())
                                                                ? phone.InnerText.Trim()
                                                                : string.Empty;
                var email = fields.Where(n => n.HasAttributes &&
                                         null != n.Attributes["class"] &&
                                         n.ParentNode.Attributes["class"].Value.Contains("field-name-field-email") &&
                                         !n.Attributes["class"].Value.Contains("field-label")).FirstOrDefault();
                meeting.Email = null != email && !string.IsNullOrWhiteSpace(email.InnerText.Trim())
                                                                ? email.InnerText.Trim()
                                                                : string.Empty;
                var daysOpenMeeting = fields.Where(n => null != n.ParentNode &&
                                                   n.HasAttributes &&
                                                   null != n.Attributes["class"] &&
                                                   n.ParentNode.HasAttributes &&
                                                   null != n.ParentNode.Attributes["class"] &&
                                                   n.ParentNode.Attributes["class"].Value.Contains("field-type-text")).FirstOrDefault();
                try
                {
                    if (null != daysOpenMeeting &&
                        null != daysOpenMeeting.ChildNodes &&
                        daysOpenMeeting.HasChildNodes &&
                        daysOpenMeeting.ChildNodes.Count > -1)
                    {
                        meeting.DaysOpenMeeting = (daysOpenMeeting.ChildNodes.Count > 0 &&
                                                   null != daysOpenMeeting.ChildNodes[1] &&
                                                   !string.IsNullOrWhiteSpace(daysOpenMeeting.ChildNodes[1].InnerText.Trim()))
                                                                                ? daysOpenMeeting.ChildNodes[1].InnerText.Trim()
                                                                                : (daysOpenMeeting.ChildNodes.Count > -1 &&
                                                                                   null != daysOpenMeeting.ChildNodes[0] &&
                                                                                   !string.IsNullOrWhiteSpace(daysOpenMeeting.ChildNodes[0].InnerText.Trim()))
                                                                                        ? daysOpenMeeting.ChildNodes[1].InnerText.Trim()
                                                                                        : string.Empty;
                    }
                }
                catch
                {
                }
                var note = fields.Where(n => n.HasAttributes &&
                                        null != n.Attributes["class"] &&
                                        n.ParentNode.Attributes["class"].Value.Contains("field-collection-view")).FirstOrDefault();
                meeting.Note = null != note && !string.IsNullOrWhiteSpace(note.InnerText.Trim())
                                                                ? note.InnerHtml.Trim()
                                                                : string.Empty;
                var additionalInformation = new List <string>();
                var notesList             = new List <string>();
                var infoFields            = meetingNode.SelectNodes(".//div[contains(@class, 'field-item')]")
                                            .Where(n => n.HasAttributes &&
                                                   null != n.Attributes["class"] &&
                                                   n.Attributes["class"].Value.Contains("even") &&
                                                   !n.Name.ToLower().StartsWith("<a"));
                var additionalInfoNode = meetingNode.SelectSingleNode(".//div[contains(@class, 'field-name-field-note')]");
                IEnumerable <HtmlNode> additionalInfoFields = new List <HtmlNode>();
                if (null != additionalInfoNode && null != additionalInfoNode.ChildNodes && additionalInfoNode.HasChildNodes)
                {
                    additionalInfoFields = additionalInfoNode.SelectNodes(".//div[contains(@class, 'field-item')]")
                                           .Where(n => n.HasAttributes &&
                                                  null != n.Attributes["class"] &&
                                                  n.Attributes["class"].Value.Contains("even"));
                }
                IEnumerable <HtmlNode> additionalInfoNodes = new List <HtmlNode>();
                var counter  = 0;
                var skipNext = false;
                if (null != infoFields)
                {
                    foreach (var node in infoFields)
                    {
                        if (node.ParentNode.HasAttributes &&
                            null != node.ParentNode.Attributes &&
                            null != node.ParentNode.ParentNode.Attributes["class"] &&
                            node.ParentNode.ParentNode.Attributes["class"].Value.Contains("field field-name-field-note") &&
                            node.HasAttributes &&
                            null != node.Attributes["class"] &&
                            node.Attributes["class"].Value.Contains("field-label"))
                        {
                            break;
                        }
                        if (notesList.Contains(node.InnerText) ||
                            notesList.Contains(node.InnerHtml))
                        {
                            continue;
                        }
                        if (counter == 0 && node.InnerHtml.StartsWith("<a") || node.Name.StartsWith("a"))
                        {
                            continue;
                        }
                        skipNext = false;
                        if (node.HasAttributes && !string.IsNullOrWhiteSpace(node.InnerHtml) || !string.IsNullOrWhiteSpace(node.InnerText))
                        {
                            if (!string.IsNullOrWhiteSpace(node.InnerHtml.Trim()) &&
                                !notesList.Contains(node.InnerHtml.Trim()) &&
                                !notesList.Contains(node.InnerText.Trim()) &&
                                null != meeting.MeetingInfo &&
                                string.IsNullOrWhiteSpace(meeting.MeetingInfo.Trim()))
                            {
                                if (node.InnerText.Trim().ToLower().Contains("möte"))
                                {
                                    meeting.MeetingInfo = node.InnerText.Trim();
                                }
                            }
                            if (!string.IsNullOrWhiteSpace(node.InnerHtml) &&
                                !notesList.Contains(node.InnerHtml.Trim()) &&
                                !notesList.Contains(node.InnerText.Trim()) &&
                                node.InnerHtml.Contains(node.InnerText.Trim()))
                            {
                                var outerHtml = textUtility.ConfirmHtml(node.InnerHtml);
                                if (!string.IsNullOrWhiteSpace(outerHtml))
                                {
                                    notesList.Add(outerHtml);
                                }
                                skipNext = true;
                                continue;
                            }
                            if (!string.IsNullOrWhiteSpace(node.InnerText) &&
                                !notesList.Contains(node.InnerText.Trim()) &&
                                !notesList.Contains(node.InnerHtml.Trim()) &&
                                !skipNext)
                            {
                                notesList.Add(node.InnerText.Trim());
                                skipNext = false;
                            }
                        }
                        counter++;
                    }
                }
                if (null != additionalInfoNodes)
                {
                    foreach (var node in additionalInfoFields)
                    {
                        if (additionalInformation.Contains(node.InnerText) ||
                            additionalInformation.Contains(node.InnerHtml))
                        {
                            continue;
                        }
                        if (!string.IsNullOrWhiteSpace(node.InnerHtml.Trim()) &&
                            !additionalInformation.Contains(node.InnerHtml.Trim()) &&
                            !additionalInformation.Contains(node.InnerText.Trim()))
                        {
                            var outerHtml = textUtility.ConfirmHtml(node.InnerHtml);
                            if (!string.IsNullOrWhiteSpace(outerHtml))
                            {
                                additionalInformation.Add(outerHtml);
                            }
                            skipNext = true;
                            continue;
                        }
                        if (!string.IsNullOrWhiteSpace(node.InnerText.Trim()) &&
                            !additionalInformation.Contains(node.InnerText.Trim()) &&
                            !additionalInformation.Contains(node.InnerHtml.Trim()) &&
                            !skipNext)
                        {
                            additionalInformation.Add(node.InnerText.Trim());
                            skipNext = false;
                        }
                    }
                }

                meeting.NotesList      = notesList;
                meeting.AdditionalInfo = additionalInformation;
                var stringBuilder = new StringBuilder();
                foreach (var node in additionalInformation)
                {
                    stringBuilder.AppendFormat("<p>{0}</p>", node).AppendLine();
                }
                meeting.AdditionalInformationHtmlString = stringBuilder.ToString();
                var flagNode     = meetingNode.SelectSingleNode(".//div[contains(@class, 'meeting-schedule')]//div[contains(@class, 'flag')]");
                var tableBody    = meetingNode.SelectSingleNode(".//table[contains(@class, 'meetings-table')]/tbody");
                var languageNode = flagNode.ChildNodes.Where(n => null != n.Attributes && n.HasAttributes &&
                                                             null != n.Attributes["class"] &&
                                                             n.Attributes["class"].Value.Contains("flag-")).SingleOrDefault();
                if (null != languageNode)
                {
                    var flagArray = languageNode.Attributes["class"].Value.Split(new char[] { ' ', '.' });
                    var flag      = flagArray[flagArray.Length - 1].Replace("flag-", "");
                    meeting.Language = flag;
                }
                var tableBodyRows = tableBody.SelectNodes(".//tr");
                var dayAndTimes   = new List <MeetingSpecific>();
                for (var r = 0; r < tableBodyRows.Count; r++)
                {
                    var tableBodyCells = tableBodyRows[r].SelectNodes(".//td");
                    if (null == tableBodyCells)
                    {
                        continue;
                    }
                    for (var dt = 0; dt < tableBodyCells.Count; dt++)
                    {
                        var meetingSpecific = new MeetingSpecific();
                        DateTime.TryParseExact(tableBodyCells[dt].InnerText.Trim(), "HH:mm", CultureInfo.InvariantCulture,
                                               DateTimeStyles.None, out DateTime dateTime);
                        TimeSpan time = dateTime.TimeOfDay;
                        meetingSpecific.StartTime = time;
                        CssStyleCollection style = new Panel().Style;
                        var tdStyles             = (null != tableBodyCells[dt] && tableBodyCells[dt].HasAttributes &&
                                                    null != tableBodyCells[dt].Attributes["style"] &&
                                                    !string.IsNullOrWhiteSpace(tableBodyCells[dt].Attributes["style"].Value.Trim()))
                                                        ? tableBodyCells[dt].Attributes["style"].Value.Trim()
                                                        : string.Empty;
                        style.Value = tdStyles;
                        style.Remove("width");
                        var styleColor = (null != style &&
                                          null != style.Value &&
                                          !string.IsNullOrWhiteSpace(style.Value))
                                                        ? style.Value.ToLower().Replace("background-color:", string.Empty)
                                         .Replace(";", string.Empty)
                                         .Trim()
                                                        : string.Empty;
                        var meetingType = scraperUtility.GetMeetingTypesAA(styleColor);
                        var id          = -1;
                        int.TryParse((r.ToString() + dt.ToString()), out id);
                        meetingSpecific.Id          = id;
                        meetingSpecific.Row         = r;
                        meetingSpecific.StartTime   = time;
                        meetingSpecific.MeetingDay  = dt;
                        meetingSpecific.MeetingType = meetingType;
                        dayAndTimes.Add(meetingSpecific);
                        meeting.DayAndTime = dayAndTimes;
                    }
                }

                meetingList.Add(meeting);
            }
            return(meetingList);
        }
        private async Task <IEnumerable <Meeting> > SetMeetingList()
        {
            var scraperUtility = new ScraperUtilities();
            var textUtility    = new TextUtility();
            var url            = "https://www.nasverige.org/main_server/client_interface/jsonp/?switcher=GetSearchResults&get_used_formats&lang_enum=sv&data_field_key=location_postal_code_1,duration_time,start_time,time_zone,weekday_tinyint,service_body_bigint,longitude,latitude,location_province,location_municipality,location_street,location_info,location_text,location_neighborhood,formats,format_shared_id_list,comments,meeting_name,location_sub_province,worldid_mixed,root_server_uri,id_bigint,meeting_name,location_text,formatted_address,formatted_location_info,virtual_meeting_link,virtual_meeting_link,show_qrcode,virtual_meeting_link,phone_meeting_number,phone_meeting_number,show_qrcode,phone_meeting_number,latitude,longitude,latitude,longitude,map_word,latitude,longitude,contact_name_1,contact_phone_1,contact_email_1,contact_name_2,contact_phone_2,contact_email_2&services[]=2&recursive=1&sort_keys=start_time&callback=jQuery35108984379689974507_1614608665780&_=1614608665781";
            var handler        = new HttpClientHandler();
            var httpClient     = new HttpClient(handler, false);
            var response       = await httpClient.GetStringAsync(url);

            var jsonString   = response.Substring(response.IndexOf("(") + 1, response.LastIndexOf(")") - response.IndexOf("(") - 1);
            var jObject      = JObject.Parse(jsonString);
            var naMeetings   = new List <NAMeeting>();
            var meetingsList = JsonConvert.DeserializeObject <NAJsonToClass>(jObject.ToString());
            var culture      = new CultureInfo("sv-SE");
            var meetingList  = new List <Meeting>();

            if (null != meetingsList.meetings && meetingsList.meetings.Any())
            {
                foreach (var naMeeting in meetingsList.meetings.OrderBy(m => HttpUtility.HtmlDecode(m.meeting_name), StringComparer.Create(culture, false)))
                {
                    var meeting          = new Meeting();
                    var meetingExist     = false;
                    var meetingSpecifics = new List <MeetingSpecific>();
                    if (null != naMeeting.meeting_name.Trim() && meetingList.Any(m => m.GroupName.Trim() == HttpUtility.HtmlDecode(naMeeting.meeting_name.Trim())))
                    {
                        meeting      = meetingList.Where(m => m.GroupName.Trim() == HttpUtility.HtmlDecode(naMeeting.meeting_name.Trim())).FirstOrDefault();
                        meetingExist = true;
                    }
                    if (!meetingExist)
                    {
                        var dayAndTime = new List <MeetingSpecific>();
                        meeting.GroupName           = naMeeting.meeting_name.Trim();
                        meeting.Id                  = Convert.ToInt32(naMeeting.id_bigint);
                        meeting.Address.Street      = naMeeting.location_street.Trim();
                        meeting.Address.City        = naMeeting.location_municipality.Trim();
                        meeting.Address.Zip         = naMeeting.location_postal_code_1.Trim();
                        meeting.Address.FullAddress = string.Format("{0}, {1} {2}", naMeeting.location_street.Trim(),
                                                                    naMeeting.location_postal_code_1.Trim(),
                                                                    naMeeting.location_municipality.Trim());
                        meeting.Place                = naMeeting.location_text.Trim();
                        meeting.Address.Longitude    = double.Parse(naMeeting.longitude.Trim());
                        meeting.Address.Lattitude    = double.Parse(naMeeting.latitude.Trim());
                        meeting.Address.LocationLink = string.Format("https://www.google.com/maps/search/?api=1&query={0}.0090711&q={1},17.0090711"
                                                                     , meeting.Address.Longitude
                                                                     , meeting.Address.Lattitude);
                        meeting.GroupLink = naMeeting.root_server_uri.Trim();
                        meeting.Email     = naMeeting.contact_email_1.Trim();
                        meeting.Phone     = naMeeting.phone_meeting_number.Trim();
                        meeting.Note      = naMeeting.comments.Trim();
                        meeting.Language  = "sv";
                        var districts = new List <District> {
                            new District {
                                DistrictName = naMeeting.location_province
                            }
                        };
                        meeting.Address.Districts = districts.AsEnumerable();
                        meeting.AdditionalInformationHtmlString = naMeeting.location_info.Trim();
                        var meetingSpecific = new MeetingSpecific();
                        DateTime.TryParse(naMeeting.start_time.Trim(), out DateTime dateTime);
                        TimeSpan startTime = dateTime.TimeOfDay;
                        TimeSpan endTime   = dateTime.Add(TimeSpan.Parse(naMeeting.duration_time)).TimeOfDay;
                        meeting.OnlineLink         = naMeeting.virtual_meeting_link.Trim();
                        meetingSpecific.MeetingDay = Convert.ToInt32(naMeeting.weekday_tinyint.Trim()) - 1;
                        meetingSpecific.StartTime  = startTime;
                        meetingSpecific.EndTime    = endTime;
                        var tags       = new List <MeetingTypes>();
                        var typesArray = naMeeting.formats.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
                        foreach (var tag in typesArray)
                        {
                            var type = scraperUtility.GetMeetingTypesCA(tag.Trim());
                            if (type == MeetingTypes.NotSet)
                            {
                                continue;
                            }
                            tags.Add(type);
                        }
                        meetingSpecific.MeetingTypes = tags.AsEnumerable();
                        if (tags.Any())
                        {
                            meetingSpecific.MeetingType = tags[0];
                        }
                        meeting.HandicapFriendly = meetingSpecific.MeetingTypes.ToList().Contains(MeetingTypes.HandicapFriendly);
                        dayAndTime = (null != meeting.DayAndTime && meeting.DayAndTime.Any())
                                                                                ? meeting.DayAndTime.ToList()
                                                                                : new List <MeetingSpecific>();
                        if (null != dayAndTime && !dayAndTime.Any())
                        {
                            for (var t = 0; t < 7; t++)
                            {
                                dayAndTime.Add(new MeetingSpecific {
                                    MeetingDay = t, StartTime = TimeSpan.FromTicks(0), EndTime = TimeSpan.FromTicks(0)
                                });
                            }
                        }
                        if (null != dayAndTime)
                        {
                            if (dayAndTime.Any() && !dayAndTime.Contains(meetingSpecific) && null == dayAndTime.FirstOrDefault(d => d.MeetingDay == meetingSpecific.MeetingDay &&
                                                                                                                               meetingSpecific.StartTime.Ticks == d.StartTime.Ticks) && meetingSpecific.StartTime.Ticks > 0)
                            {
                                for (var t = 0; t < 7; t++)
                                {
                                    dayAndTime.Add(new MeetingSpecific {
                                        MeetingDay = t, StartTime = TimeSpan.FromTicks(0), EndTime = TimeSpan.FromTicks(0)
                                    });
                                }
                            }
                            for (var t = 0; t < dayAndTime.Count; t++)
                            {
                                if (dayAndTime.Contains(meetingSpecific) || meetingSpecific.StartTime.Ticks <= 0)
                                {
                                    continue;
                                }
                                if (dayAndTime[t].MeetingDay == meetingSpecific.MeetingDay && dayAndTime[t].StartTime.Ticks <= 0 && meetingSpecific.StartTime.Ticks > 0)
                                {
                                    dayAndTime[t] = meetingSpecific;
                                }
                            }
                        }
                        var lastRow = (dayAndTime.Count > 7) ? dayAndTime.GetRange(dayAndTime.Count - 7, 7).Sum(t => t.StartTime.Ticks) : -1;
                        if (lastRow <= 0)
                        {
                            dayAndTime.RemoveRange(dayAndTime.Count - 7, 7);
                        }
                        meeting.DayAndTime = dayAndTime.AsEnumerable();
                        if (meetingExist)
                        {
                            var indexMeeting = meetingList.Where(m => m.GroupName.Trim() == naMeeting.meeting_name.Trim()).FirstOrDefault();
                            var index        = meetingList.IndexOf(indexMeeting);
                            if (index != -1)
                            {
                                meetingList[index] = meeting;
                            }
                        }
                        else
                        {
                            meetingList.Add(meeting);
                        }
                    }
                }
            }

            return(meetingList);
        }