Beispiel #1
0
        public async Task CreateDataTagA(DataTagA data)
        {
            //var context = new MyDbContext(_connectionString);
            await _context.DataTagA.AddAsync(data);

            await _context.SaveChangesAsync();
        }
Beispiel #2
0
        private void GetHref(string value)
        {
            bool has = false;

            try
            {
                string dom = DataBacklinkRow.Domain;
                HtmlAgilityPack.HtmlDocument html = new HtmlAgilityPack.HtmlDocument();
                html.LoadHtml(value);
                var hs = html.DocumentNode.SelectNodes("//a");
                foreach (var h in hs)
                {
                    string href = h.GetAttributeValue("href", ""), rel = h.GetAttributeValue("rel", "");

                    if (href == "")
                    {
                        continue;
                    }

                    if (rel == "")
                    {
                        rel = "dofollow";
                    }

                    if (href.Contains(dom))
                    {
                        DataTagA = new DataTagA()
                        {
                            Anchor = h.InnerText, Href = href, Rel = rel, DataBacklinkRowID = DataBacklinkRow.ID
                        };

                        has = true;
                    }
                }
            }
            catch
            {
            }
            if (has)
            {
                DataBacklinkRow.Status = DataBacklinkRow.Status == Status.PlainHttp ? Status.PlainHttpFound : Status.WebDriverFound;
            }
            else
            {
                DataBacklinkRow.Status = DataBacklinkRow.Status == Status.PlainHttp ? Status.PlainHttpNotFound : Status.WebDriverNotFound;
            }
        }