Created
February 23, 2021 16:23
-
-
Save saasindustries/23637115c851a1c99f153e0f7084693a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static List<AdDetails> GetAdDetails(List<string> urls, string Keyword){ | |
var lstAdDetails = new List<AdDetails>(); | |
foreach (var url in urls){ | |
var htmlNode = GetHtml(url); | |
var AdDetails = new AdDetails(); | |
AdDetails.AdTitle = htmlNode.OwnerDocument.DocumentNode.SelectSingleNode("//html/head/title").InnerText; | |
var description = htmlNode.OwnerDocument.DocumentNode.SelectSingleNode("//html/body/section/section/section/section").InnerText; | |
AdDetails.AdDescription = description.Replace("\n \n QR Code Link to This Post\n \n \n", ""); | |
AdDetails.AdUrl = url; | |
var KeywordInTitle = AdDetails.AdTitle.ToLower().Contains(Keyword.ToLower()); | |
var KeywordInDescription = AdDetails.AdDescription.ToLower().Contains(Keyword.ToLower()); | |
if(KeywordInTitle || KeywordInDescription){ | |
lstAdDetails.Add(AdDetails); | |
} | |
} | |
return lstAdDetails; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment